1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

When a table is part of a LEFT JOIN and should be a completely NULL row due to

the semantics of a LEFT JOIN, make sure any generated columns on that row
evaluate to NULL.  Ticket [3b84b42943644d6f]

FossilOrigin-Name: 0271491438ad2a985aeff355173a8d0f1e5813954c82147bc68cb26cca5804c8
This commit is contained in:
drh
2019-12-16 16:52:22 +00:00
parent d35bdd6c09
commit 4dad7ed532
4 changed files with 43 additions and 10 deletions

View File

@ -419,4 +419,28 @@ do_execsql_test gencol1-15.20 {
SELECT a, quote(b) FROM t1
} {9 NULL}
# 2019-12-16 ticket 3b84b42943644d6f
# When a table is the right table of a LEFT JOIN and the ON clause is
# false, make sure any generated columns evaluate to NULL.
reset_db
do_execsql_test gencol1-16.10 {
CREATE TABLE t0(c0);
CREATE TABLE t1(c1, c2 AS(1));
INSERT INTO t0 VALUES(0);
SELECT c0, c1, c2 FROM t0 LEFT JOIN t1;
} {0 {} {}}
do_execsql_test gencol1-16.20 {
DROP TABLE t1;
CREATE TABLE t1(c1, c2 AS (c1 ISNULL));
SELECT c0, c1, c2 FROM t0 LEFT JOIN t1;
} {0 {} {}}
do_execsql_test gencol1-16.30 {
INSERT INTO t1(c1) VALUES(1),(NULL);
SELECT * FROM t1;
} {1 0 {} 1}
do_execsql_test gencol1-16.40 {
SELECT c0, c1, c2 FROM t0 LEFT JOIN t1 ON c0=c1;
} {0 {} {}}
finish_test