SQLite

View Ticket
Login
Ticket Hash: 3557ad65a076ca6bb71d57d6fba0e7e1bad7e425
Title: Incorrect DISTINCT on an indexed query with IN
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2012-03-03 01:44:33
Version Found In: 3.7.10
Description:
Reported on the mailing list. The following SQL gives an incorrect result:
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES(1,1);
INSERT INTO t1 VALUES(2,1);
INSERT INTO t1 VALUES(3,1);
INSERT INTO t1 VALUES(2,2);
INSERT INTO t1 VALUES(3,2);
INSERT INTO t1 VALUES(4,2);
CREATE INDEX t1ab ON t1(a,b);
SELECT DISTINCT b from t1 WHERE a IN (1,2,3);

drh added on 2012-03-03 01:35:55:
Introduced by check-in [45e581bff7a75d] on 2011-07-02 for release 3.7.8.