1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Ensure that the query planner knows that any column of a flattened LEFT JOIN

can be NULL even if that column is labeled with "NOT NULL".
Fix for ticket [892fc34f173e99d8].

FossilOrigin-Name: 483462682d3a57fb9dd85b4772596e9738f1694a454b8ebbc480b9452733e88d
This commit is contained in:
dan
2017-06-20 17:43:26 +00:00
parent 40db2fd7a3
commit bd11a2acbb
4 changed files with 32 additions and 12 deletions

View File

@ -763,4 +763,21 @@ do_execsql_test join-14.12 {
SELECT *, '|' FROM t3 LEFT JOIN v2 ON a=x ORDER BY b;
} {4 {} {} | 2 2 1 |}
# Verify the fix for ticket
# https://www.sqlite.org/src/info/892fc34f173e99d8
#
db close
sqlite3 db :memory:
do_execsql_test join-14.20 {
CREATE TABLE t1(id INTEGER PRIMARY KEY);
CREATE TABLE t2(id INTEGER PRIMARY KEY, c2 INTEGER);
CREATE TABLE t3(id INTEGER PRIMARY KEY, c3 INTEGER);
INSERT INTO t1(id) VALUES(456);
INSERT INTO t3(id) VALUES(1),(2);
SELECT t1.id, x2.id, x3.id
FROM t1
LEFT JOIN (SELECT * FROM t2) AS x2 ON t1.id=x2.c2
LEFT JOIN t3 AS x3 ON x2.id=x3.c3;
} {456 {} {}}
finish_test