ADD COLUMN unquotes a keyword column inside a FOREIGN KEY clause, and SQLite can no longer read the table
Author: LeMikaelFCreated Sep 16, 2026Updated Sep 16, 2026
Labelscompatibilityfuzzingschema changesforeign keys
ADD COLUMN rewrites the table text in sqlite_master. A quoted keyword column name inside a FOREIGN KEY clause loses its quotes. turso can still open the file, but SQLite cannot read the table.
-- In turso:
CREATE TABLE t0("id" INTEGER PRIMARY KEY);
CREATE TABLE t1("id" INTEGER PRIMARY KEY, "order" REAL, FOREIGN KEY("order") REFERENCES "t0"("id"));
ALTER TABLE t1 ADD COLUMN added INTEGER;
SELECT sql FROM sqlite_master WHERE name = 't1';
-- turso: CREATE TABLE t1 (id INTEGER PRIMARY KEY, "order" REAL, added INTEGER, FOREIGN KEY (order) REFERENCES t0(id))
-- SQLite opening the file: malformed database schema (t1) - near "order": syntax errorEvery statement on t1 fails in SQLite, including PRAGMA integrity_check. Same cause as #9068 (there the quotes are lost inside a table-level PRIMARY KEY, and turso itself cannot reopen the file).
Found by differential testing of turso dc5fda12 against SQLite 3.53.2 with generated schema changes on the FrankenSQLite harness (own schema generator, 375 of 800 seeds hit this).
Source: tursodatabase/turso