SQLite

View Ticket
Login
Ticket Hash: 45f4bf4eb4ffd7884266850bf0ca2ffbad568752
Title: UNION operator malfunctions in LEFT JOIN on view
Status: Closed Type: Code_Defect
Severity: Minor Priority: Low
Subsystem: Unknown Resolution: Fixed
Last Modified: 2020-04-25 15:02:43
Version Found In: 3.32.0
User Comments:
mrigger added on 2020-04-25 08:52:37:

Consider the following statements:

CREATE TABLE t0(c0 INT);
CREATE VIEW v0(c0) AS SELECT CAST(t0.c0 AS INTEGER) FROM t0;
INSERT INTO t0(c0) VALUES (0);
SELECT * FROM t0 LEFT JOIN v0 ON v0.c0 >= '0' WHERE TRUE UNION SELECT 0,0 WHERE 0; -- expected: {0|0}, actual:{0|NULL}

Unexpectedly, the result of the query is {0|NULL}, rather than {0|0}. When replacing the ON clause by TRUE, the query works as expected. I found this based on commit b4987a5ced.