fix: table-level PRIMARY KEY(col) rowid alias reads back NULL when the table has other columns (#686) - #715
Open
dpsiderius wants to merge 1 commit into
Open
dpsiderius wants to merge 1 commit into
dpsiderius wants to merge 1 commit into
Conversation
…e table has other columns (#686) rowid_alias_from_sql's table-level PRIMARY KEY(col) branch only recognized the rowid-alias form when the PK column was the table's sole column. Per the oracle, only a composite key (or non-INTEGER type) rules out the optimization -- other columns don't. Match the constraint's named column against the column list directly instead of requiring a single-column table. Refs: 001/Req-4, #685
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
src/schema/ddl_reader.rs::rowid_alias_from_sqlrequired a table-levelPRIMARY KEY (col)to name the table's only column before treating itas a rowid alias. That is not SQLite's rule: a second column does not
rule it out. The reader now matches the named column against the column
list directly.
Before/after (measured against the pinned oracle)
Test matrix: table-level PK on a single INTEGER column with/without other
columns, non-INTEGER typed, composite (no alias), column-level control
(regression guard, was already correct).
Test plan
tests/corpus/rowid_alias_test.rs— full rule table, oracle-diffed.make test,make lint,make test-corpus,make check-mvl-limit,make check-mod-files,make assuranceall pass.Refs: 001/Req-*, #705
Closes #686
spend: matched estimate