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

For an outer join, then ON-clause constraints need to be evaluated at just

the right moment - not too early and not too late.  Fix for the problem
reported by [forum:/forumpost/3902c7b833|forum post 3902c7b833].

FossilOrigin-Name: 3869fd9a2b9483cbbf83d8f369c1744abc42f12e63abba402be35dd7e136161c
This commit is contained in:
drh
2022-05-30 17:33:22 +00:00
parent 1943005f62
commit 404bf6bac6
4 changed files with 48 additions and 14 deletions

View File

@ -445,4 +445,41 @@ do_execsql_test join8-14020 {
- 2 4
}
# 2022-05-30
# https://sqlite.org/forum/forumpost/3902c7b833
#
reset_db
do_execsql_test join8-15000 {
CREATE TABLE t1(x INT);
CREATE TABLE t2(y INT);
CREATE TABLE t3(z INT);
INSERT INTO t1 VALUES(10);
INSERT INTO t3 VALUES(20),(30);
}
do_execsql_test join8-15010 {
SELECT * FROM t1 LEFT JOIN t2 ON true JOIN t3 ON t2.y IS NOT NULL;
} {}
do_execsql_test join8-15020 {
SELECT * FROM t1 LEFT JOIN t2 ON true JOIN t3 ON t2.y IS NOT NULL
WHERE (t3.z!=400 AND t3.z!=500 AND t3.z!=600);
} {}
do_execsql_test join8-15100 {
PRAGMA automatic_index = 0;
CREATE TABLE t4(x TEXT);
CREATE TABLE t5(y TEXT);
CREATE TABLE t6(z TEXT);
INSERT INTO t4 VALUES('a'), ('b');
INSERT INTO t5 VALUES('b'), ('c');
INSERT INTO t6 VALUES('a'), ('d');
} {}
db null -
do_execsql_test join8-15110 {
SELECT * FROM t4 LEFT JOIN t5 ON x=y LEFT JOIN t6 ON (x=z) ORDER BY +x;
} {a - a b b -}
do_execsql_test join8-15120 {
SELECT * FROM t4 LEFT JOIN t5 ON x=y LEFT JOIN t6 ON (x=z)
WHERE t5.y!='x' AND t4.x!='x';
} {b b -}
finish_test