-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
unique constraint error with INSERT (1), (2) #407
Comments
the reason is the NotNull opcode on line 10 which prevents NewRowid from being called again on the second iteration - register 1 is not null at that point because it contains the first created rowid, and after that it fails the NotExists check. edit: actually im not sure if thats the reason .... anyway heres the bytecode difference: edit2: ok i think the problem here is: the insert would be correctly called with two distinct values of r[2], but the NotNull and NotExists checks are made against the same value of r[1] because NewRowid ends up getting called only once.
quite different bytecode |
With i guess the difference here is that now the rowids come externally from the query so NewRowid is never called (because x is the INTEGER PRIMARY KEY, whereas in the first table with no INTEGER PRIMARY KEY they are generated with NewRowid) So to make these correct we need to be aware of whether the user is inserting the rowid explicitly or not (i.e. INTEGER PRIMARY KEY or not) Since we currently only support plain rowid tables (I think?) we should just copy sqlite's implementation from the first comment |
The text was updated successfully, but these errors were encountered: