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/unionall2.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/unionall2.test')
-rw-r--r-- | test/unionall2.test | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/unionall2.test b/test/unionall2.test new file mode 100644 index 0000000..5f095e4 --- /dev/null +++ b/test/unionall2.test @@ -0,0 +1,58 @@ +# 2020-12-22 +# +# 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. The +# focus of this file is flattening UNION ALL sub-queries. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +set testprefix unionall2 + +do_execsql_test 1.0 { + CREATE TABLE t1(a, b); + CREATE TABLE t2(c, d); + + CREATE VIEW v1 AS SELECT * FROM t1, t2; + CREATE VIEW v2 AS SELECT * FROM t1, t2; + + CREATE VIEW vA AS + SELECT * FROM v1, ( + SELECT * FROM t1 LEFT JOIN t2 ON (a=c) + ) + UNION ALL + SELECT * FROM v1, v2 +} + +do_execsql_test 1.1 { + SELECT 1 FROM vA, vA, vA, vA, vA, vA, vA, vA, vA, vA +} + +#------------------------------------------------------------------------- + +do_execsql_test 2.1 { + CREATE TABLE y1(a INTEGER, b); + CREATE TABLE y2(c INTEGER, d); + + CREATE TABLE x3_a(a INTEGER PRIMARY KEY, b TEXT); + CREATE TABLE x3_b(c INTEGER PRIMARY KEY, d TEXT); +} + +do_execsql_test 2.2 { + + SELECT * FROM y1 CROSS JOIN y2 WHERE y1.a=y2.c AND y2.c IN ( + SELECT a FROM x3_a UNION ALL + SELECT c FROM x3_b ORDER BY 1 + ) +} + + + +finish_test |