3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this file is flattening UNION ALL sub-queries.
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17 set testprefix unionall2
20 CREATE TABLE t1(a, b);
21 CREATE TABLE t2(c, d);
23 CREATE VIEW v1 AS SELECT * FROM t1, t2;
24 CREATE VIEW v2 AS SELECT * FROM t1, t2;
28 SELECT * FROM t1 LEFT JOIN t2 ON (a=c)
35 SELECT 1 FROM vA, vA, vA, vA, vA, vA, vA, vA, vA, vA
38 #-------------------------------------------------------------------------
41 CREATE TABLE y1(a INTEGER, b);
42 CREATE TABLE y2(c INTEGER, d);
44 CREATE TABLE x3_a(a INTEGER PRIMARY KEY, b TEXT);
45 CREATE TABLE x3_b(c INTEGER PRIMARY KEY, d TEXT);
50 SELECT * FROM y1 CROSS JOIN y2 WHERE y1.a=y2.c AND y2.c IN (
51 SELECT a FROM x3_a UNION ALL
52 SELECT c FROM x3_b ORDER BY 1