diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:28:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:28:19 +0000 |
commit | 18657a960e125336f704ea058e25c27bd3900dcb (patch) | |
tree | 17b438b680ed45a996d7b59951e6aa34023783f2 /test/joinH.test | |
parent | Initial commit. (diff) | |
download | sqlite3-18657a960e125336f704ea058e25c27bd3900dcb.tar.xz sqlite3-18657a960e125336f704ea058e25c27bd3900dcb.zip |
Adding upstream version 3.40.1.upstream/3.40.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/joinH.test')
-rw-r--r-- | test/joinH.test | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/test/joinH.test b/test/joinH.test new file mode 100644 index 0000000..1d5f66a --- /dev/null +++ b/test/joinH.test @@ -0,0 +1,93 @@ +# 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!} + +#----------------------------------------------------------- +reset_db +do_execsql_test 3.1 { + CREATE TABLE t0 (c0); + CREATE TABLE t1 (c0); + CREATE TABLE t2 (c0 , c1 , c2 , UNIQUE (c0), UNIQUE (c2 DESC)); + INSERT INTO t2 VALUES ('x', 'y', 'z'); + ANALYZE; + CREATE VIEW v0(c0) AS SELECT FALSE; +} + +do_catchsql_test 3.2 { + SELECT * FROM t0 LEFT OUTER JOIN t1 ON v0.c0 INNER JOIN v0 INNER JOIN t2 ON (t2.c2 NOT NULL); +} {1 {ON clause references tables to its right}} + +#------------------------------------------------------------- + +reset_db +do_execsql_test 4.1 { + CREATE TABLE t1(a,b,c,d,e,f,g,h,PRIMARY KEY(a,b,c)) WITHOUT ROWID; + CREATE TABLE t2(i, j); + INSERT INTO t2 VALUES(10, 20); +} + +do_execsql_test 4.2 { + SELECT (d IS NULL) FROM t1 RIGHT JOIN t2 ON (j=33); +} {1} + +do_execsql_test 4.3 { + CREATE INDEX i1 ON t1( (d IS NULL), d ); +} + +do_execsql_test 4.4 { + SELECT (d IS NULL) FROM t1 RIGHT JOIN t2 ON (j=33); +} {1} + + +finish_test |