Skip to content

fix(linux-sqlite): let SQLite decide what holds a dropped column - #3455

Merged
datlechin merged 7 commits into
linuxfrom
fix/linux-sqlite-rebuild-references
Oct 16, 2026
Merged

datlechin merged 7 commits into
linuxfrom
fix/linux-sqlite-rebuild-references

Conversation

@datlechin

Copy link
Copy Markdown
Member

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 end could 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

  • A rebuild lets SQLite decide: after the views and triggers are made again, an ALTER TABLE re-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_table is pinned OFF.
  • Column lists SQLite never checks (INSERT columns, UPDATE SET, upsert, UPDATE OF) are read exactly and refused before Save, for the rebuild and the native DROP COLUMN.
  • The table's own CHECK constraints, generated columns and indexes are read with SQLite's grammar, so function names, collations, CAST types and keywords no longer count as columns.
  • A trigger that inserts into the table by position refuses adding a column, or dropping one that isn't generated, naming the trigger.

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_rebuild and dropping_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).

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.
@datlechin
datlechin merged commit b9c61c9 into linux Oct 16, 2026
24 checks passed
@datlechin
datlechin deleted the fix/linux-sqlite-rebuild-references branch October 17, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant