Repository navigation
fix(linux-sqlite): let SQLite decide what holds a dropped column - #3455
Merged
Merged
Conversation
A rebuild now has SQLite resolve the views and triggers it makes again, so a word like END or another table's column no longer refuses a drop. Trigger column lists, which SQLite never resolves, are still refused before Save.
SQLite refuses the new table or index with "no such column" and no name, and its DROP COLUMN names only the table for a CHECK, so these stay refused before Save, now by SQLite's grammar instead of any word.
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.
Why
Before a SQLite table rebuild that drops a column, the driver refused when any word in a trigger, view, CHECK or index matched the column name. So a column named
endcould not be dropped past a trigger's END, and a same-named column in another table blocked it. Real breakage also got through: a trigger that lists the column (INSERT columns, UPDATE SET, UPDATE OF) or inserts by position failed later when it fired.Change
ALTER TABLEre-checks the schema, and a view or trigger that reads the dropped column rolls the save back with SQLite's own message naming it.legacy_alter_tableis pinned OFF.UPDATE OF) are read exactly and refused before Save, for the rebuild and the nativeDROP COLUMN.Verified
Every new test fails on the previous driver code and passes now. Core and SQLite driver tests (743) and the full gtk suite pass.
Replaced on purpose:
dropping_a_column_a_view_uses_is_refused_in_a_rebuildanddropping_a_column_a_view_needs_is_refused_before_anything_runs. A view that reads a dropped column is now refused at Save with a rollback (a_dropped_column_something_reads_rolls_the_rebuild_back).