SQLite

View Ticket
Login
Ticket Hash: 9b78184be266fd7084e9e8038ad631a21b37eb9e
Title: Index on non-existing column results in a fabricated value being fetched
Status: Closed Type: Code_Defect
Severity: Cosmetic Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2019-05-20 17:15:29
Version Found In:
User Comments:
mrigger added on 2019-05-19 09:44:06:

Consider the example below:

CREATE TABLE t0(c1, c2);
INSERT INTO t0(c1, c2) VALUES  ('a', 1);
CREATE INDEX i0 ON t0("C3");
ALTER TABLE t0 RENAME COLUMN c1 TO c3;
SELECT DISTINCT * FROM t0; -- fetches C3|1 rather than a|1

It is possible to create an index on a column that does not exist yet. When the column is then created, the index results in the name of the column being returned, instead of a value stored in it.


dan added on 2019-05-20 17:15:29:

Addressed by commit [1685610e].