Fix: core/translate/insert: fix four issues with inserts #533
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #436
This PR fixes four issues:
INSERT INTO foo (b,c) values (1,2);
would just insert into the first two columns regardless of what indexb
andc
have)as seen here
Note that this PR doesn't fix e.g. #472 which requires creating an index on the non-rowid primary key column(s), nor does it implement rollback (e.g. inserting two rows where one fails to unique constraint still inserts the other row)
EXAMPLES OF ERRONEOUS BEHAVIOR -- current head of main:
wrong column inserted
wrong column inserted
false positive from integer check due to attempting to insert wrong column
false positive from integer check due to attempting to insert wrong column
allows write of nonexistent column
hangs forever when inserting too many values
unique constraint error on non-unique column
EXAMPLES OF CORRECT BEHAVIOR -- this branch:
correct column inserted
correct column inserted
correct columns inserted, PK autoincremented
correct column inserted, PK autoincremented
reports parse error correctly about wrong number of values
reports parse error correctly about nonexistent column
no unique constraint error on non-unique column
Also, added multi-row inserts to simulator and ran into at least this: