SQLite Forum

DROP COLUMN feature with indexes
Login
The DROP COLUMN feature (from the development branch) doesn't handle indexes:

    CREATE TABLE p1(a PRIMARY KEY, b UNIQUE);
    CREATE TABLE c1(x, y, z REFERENCES p1(c));
    CREATE TABLE c2(x, y, z, w REFERENCES p1(b));
    CREATE INDEX i_cz ON c1(z);
    CREATE INDEX i_cxy ON c2(x,z);
    ALTER TABLE c1 DROP COLUMN z;
    ALTER TABLE c2 DROP COLUMN z;
    SELECT sql FROM sqlite_schema WHERE name IN ('c1', 'c2');

The above results in:

    Error: near line 6: error in index i_cz after drop column: no such column: z
    Error: near line 7: error in index i_cxy after drop column: no such column: z