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:
57
test/joinH.test
Normal file
57
test/joinH.test
Normal 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
|
Reference in New Issue
Block a user