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

Avoid omitting the rhs of FULL JOINs in cases where it is only correct to omit the rhs of a LEFT JOIN.

FossilOrigin-Name: f23a429d4153518d37387e121f22a30b22e2b31e126ad168e72049a96be86269
This commit is contained in:
dan
2022-06-17 11:39:24 +00:00
parent 3e245bcef3
commit 2a7aff93ed
4 changed files with 67 additions and 9 deletions

57
test/joinH.test Normal file
View File

@ -0,0 +1,57 @@
# 2022 May 17
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix joinH
do_execsql_test 1.0 {
CREATE TABLE t1(a INT);
CREATE TABLE t2(b INT);
INSERT INTO t2(b) VALUES(NULL);
}
db nullvalue NULL
do_execsql_test 1.1 {
SELECT DISTINCT a FROM t1 FULL JOIN t2 ON true WHERE (b ISNULL);
} {NULL}
do_execsql_test 1.2 {
SELECT a FROM t1 FULL JOIN t2 ON true;
} {NULL}
do_execsql_test 1.3 {
SELECT a FROM t1 FULL JOIN t2 ON true WHERE (b ISNULL);
} {NULL}
do_execsql_test 1.4 {
SELECT DISTINCT a FROM t1 FULL JOIN t2 ON true;
} {NULL}
#-----------------------------------------------------------
reset_db
do_execsql_test 2.0 {
CREATE TABLE r3(x);
CREATE TABLE r4(y INTEGER PRIMARY KEY);
INSERT INTO r4 VALUES(55);
}
do_execsql_test 2.1 {
SELECT 'value!' FROM r3 FULL JOIN r4 ON (y=x);
} {value!}
do_execsql_test 2.2 {
SELECT 'value!' FROM r3 FULL JOIN r4 ON (y=x) WHERE +y=55;
} {value!}
finish_test