|Title:||DROP COLUMN leaves behind an index|
|Last Modified:||2021-03-15 14:58:51|
|Version Found In:||3.35.0|
drh added on 2021-03-14 01:20:48:
The DROP COLUMN statement below works, even though the column is indexed: > ~~~ CREATE TABLE t1(a,b); INSERT INTO t1 VALUES(1,2); CREATE INDEX x1 on t1("b"); ALTER TABLE t1 DROP COLUMN b; ~~~ Subsequently reopening the database and running "PRAGMA integrity_check" reports index corruption. The "index corruption" problem can be resolved by dropping the (now superfluous) index, so this is perhaps not a serious concern, but it does need to be fixed. The problem was reported by [Forum post e37dcf456a](https://sqlite.org/forum/forumpost/e37dcf456a). It is perhaps related to ticket (9b78184be266fd70).
drh added on 2021-03-14 12:01:09: (text/x-markdown)
A slightly different example of this problem that is not resolved by check-in (7c8aa3812599d58a). > ~~~ CREATE TABLE t1(a, b, c); CREATE UNIQUE INDEX x1 ON t1("a"||"b"); INSERT INTO t1 VALUES(1,2,3),(1,4,5); ALTER TABLE t1 DROP COLUMN b; PRAGMA integrity_check; ~~~