SQLite

View Ticket
Login
Ticket Hash: ce22a07731530118bb8ee6433474d7caf36b170c
Title: NULL WHERE condition unexpectedly results in row being fetched
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2019-11-06 17:31:43
Version Found In: 3.30.0
User Comments:
mrigger added on 2019-11-06 15:16:14:

Consider the following test case:

CREATE TABLE t0 (c0 GENERATED ALWAYS AS (1), c1 UNIQUE, c2 UNIQUE);
INSERT INTO t0(c1) VALUES (1);
SELECT * FROM t0 WHERE 0 = t0.c2 OR t0.c1 BETWEEN t0.c2 AND 1; -- unexpected: row is fetched

Unexpectedly, a row is fetched, even though the condition should evaluate to NULL:

SELECT 0 = t0.c2 OR t0.c1 BETWEEN t0.c2 AND 1 FROM t0; -- NULL