Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table import can allow NULLs in the primary key #1096

Closed
Hydrocharged opened this issue Dec 9, 2020 · 0 comments · Fixed by #1097
Closed

Table import can allow NULLs in the primary key #1096

Hydrocharged opened this issue Dec 9, 2020 · 0 comments · Fixed by #1097
Assignees
Labels
bug Something isn't working

Comments

@Hydrocharged
Copy link
Contributor

When using dolt table import -c, we currently do not follow the rule that primary keys may not contain any NULLs. This will put the table into an invalid state. It can be reproduced by:

$ dolt init
Successfully initialized dolt data repository.

$ cat <<DELIM > null-pk.csv
pk,v1
"a",1
,2
DELIM

$ dolt table import -c --pk=pk test null-pk.csv
Rows Processed: 2, Additions: 2, Modifications: 0, Had No Effect: 0
Import completed successfully.

$ dolt sql -q "select * from test"
+------+----+
| pk   | v1 |
+------+----+
| a    | 1  |
| NULL | 2  |
+------+----+

$ dolt sql -q "update test set pk = 'b' where pk is null"
column <pk> received nil but is non-nullable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant