SQLite

View Ticket
Login
2019-08-30
13:07 Fixed ticket [a6408d42]: Partial index causes row to not be fetched plus 6 other changes (artifact: 8b2e986d user: drh)
13:07
The expression "(x IS FALSE) IS FALSE" does not imply that X is not NULL. Ticket [a6408d42b9f44462] (check-in: 45ff2b1f user: drh tags: trunk)
11:33 New ticket [a6408d42] Partial index causes row to not be fetched. (artifact: ba5257e3 user: mrigger)

Ticket Hash: a6408d42b9f4446279f5ac1d6a0934665db756da
Title: Partial index causes row to not be fetched
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2019-08-30 13:07:27
Version Found In: 3.29.0
User Comments:
mrigger added on 2019-08-30 11:33:53:

In the test case below, the row in the table is unexpectedly not fetched:

CREATE TABLE t0(c0);
INSERT INTO t0(c0) VALUES (NULL);
CREATE INDEX i0 ON t0(1) WHERE c0 NOT NULL;
SELECT * FROM t0 WHERE (t0.c0 IS FALSE) IS FALSE; -- unexpected: row is not fetched

The condition should evaluate to TRUE:

SELECT (t0.c0 IS FALSE) IS FALSE FROM t0; -- TRUE