SQLite 3.35.5, released on April 19, 2021, fixes defects in ALTER TABLE DROP COLUMN that could corrupt a database file. For application teams adopting the new command, the patch level matters before a schema migration runs. The correction does not remove the command’s documented restrictions: a column that other parts of the database schema still need can remain ineligible for removal. [S1][S4]
DROP COLUMN arrived in SQLite 3.35.0 on March 12. A March 15 patch addressed a bug involving indexed columns quoted in an index definition; the April 19 release then identified further defects capable of corrupting the file. Checking only whether the engine recognizes DROP COLUMN misses that patch history. The practical recommendation is to use the corrected release and rehearse the intended migration, rather than treat acceptance of the SQL syntax as evidence that the earlier implementation is suitable. [S1][S2]
The historical ALTER TABLE documentation explains why an upgrade can still leave a migration failing. A primary-key column, a column with a UNIQUE constraint or an indexed column cannot simply be dropped. Other blockers include a reference in a partial index’s WHERE clause, a foreign-key constraint, a generated-column expression, a trigger or a view. A CHECK constraint elsewhere in the table can also prevent removal. Those are schema dependencies to resolve, not evidence that the corruption fix failed. [S4]
SQLite stores its schema as SQL text. DROP COLUMN removes the column definition from the CREATE TABLE statement and then attempts to parse the entire schema again; it succeeds only if the result remains valid. That gives a migration owner a concrete investigation: inspect the objects that reference the column before retrying the command. Removing an index or changing a view is a separate application decision, not something to assume the command will do on the team’s behalf. [S4]
There is also a scheduling difference from a simple rename. The manual says renaming a table or adding a column leaves table contents untouched, so those operations do not depend on the amount of stored data. DROP COLUMN rewrites the table contents to remove the discarded column’s data. For a large database, a prudent rehearsal would therefore use representative data as well as the real schema; timing a rename is not a useful substitute. [S4]
Source documents
- SQLite Release 3.35.5 On 2021-04-19https://www.sqlite.org/releaselog/3_35_5.html
- SQLite Release 3.35.0 On 2021-03-12https://www.sqlite.org/releaselog/3_35_0.html
- ALTER TABLE — SQLite 3.35.4 documentation editionhttps://www.sqlite.org/2021/sqlite-doc-3350400.zip
