SQLite

View Ticket
Login
Ticket Hash: 61c853857f40da49b609a20d9862a2d56ddcba15
Title: Row is not fetched in SELECT from VIEW
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2019-08-06 15:33:12
Version Found In: 3.29.0
User Comments:
mrigger added on 2019-08-05 15:09:29:

Consider the test case below:

CREATE TABLE t0(c0 TEXT, c1);
INSERT INTO t0(c0, c1) VALUES (-1, 0);
CREATE VIEW v0(c0, c1) AS SELECT t0.c0, AVG(t0.c1) FROM t0;
SELECT * FROM v0 WHERE v0.c1 < v0.c0; -- unexpected: row is not fetched

Unexpectedly, the row is not fetched. Interestingly, but as expected, the row is also not fetched when negating the WHERE condition:

SELECT * FROM v0 WHERE NOT(v0.c1 < v0.c0); -- expected: -1|0.0, actual: row is not fetched

Evaluating the condition yields TRUE:

SELECT v0.c1 < v0.c0 FROM v0; -- 1