mirror of
https://github.com/sqlite/sqlite.git
synced 2026-01-06 08:01:16 +03:00
Add extra tests to with2.test.
FossilOrigin-Name: eecc325afd72e37d7d565787c8cea68aad6d7a5c
This commit is contained in:
14
manifest
14
manifest
@@ -1,5 +1,5 @@
|
||||
C Minor\ssimplification\sof\serror\smessage\stext\sfor\sa\scouple\sof\serrors\sassociated\nwith\sWITH\sclause\sprocessing.
|
||||
D 2014-01-17T18:34:28.795
|
||||
C Add\sextra\stests\sto\swith2.test.
|
||||
D 2014-01-17T20:36:17.628
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@@ -1092,7 +1092,7 @@ F test/win32heap.test ea19770974795cff26e11575e12d422dbd16893c
|
||||
F test/win32lock.test 7a6bd73a5dcdee39b5bb93e92395e1773a194361
|
||||
F test/win32longpath.test 169c75a3b2e43481f4a62122510210c67b08f26d
|
||||
F test/with1.test 6e49c7841abb5603425f8f1316ab077f6a9bbb49
|
||||
F test/with2.test 21057990b59eb652a0a30c6a421fac9daad4412d
|
||||
F test/with2.test eaafa54aa7aec8dd824de7d166a2452a63156737
|
||||
F test/withM.test 52448ce23e1c2ecba79d10e130ee49ce9f9a2a7a
|
||||
F test/without_rowid1.test aaa26da19d543cd8d3d2d0e686dfa255556c15c8
|
||||
F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99
|
||||
@@ -1151,7 +1151,7 @@ F tool/vdbe-compress.tcl 0cf56e9263a152b84da86e75a5c0cdcdb7a47891
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
|
||||
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
|
||||
P a7323838bbd354a1c2f339e5e0f164f0eada47b3
|
||||
R eb3aa3bb26890774162c9a927560c5c6
|
||||
U drh
|
||||
Z f6f02c349d009e02c31d866af981661b
|
||||
P 2031004d960526d6426d50d7b732f37b281534e2
|
||||
R 18aca364b17ce09cd2d25269185d295f
|
||||
U dan
|
||||
Z d7942df5ea7f32fd101e4ac65d1e6fab
|
||||
|
||||
@@ -1 +1 @@
|
||||
2031004d960526d6426d50d7b732f37b281534e2
|
||||
eecc325afd72e37d7d565787c8cea68aad6d7a5c
|
||||
106
test/with2.test
106
test/with2.test
@@ -69,5 +69,111 @@ do_execsql_test 1.6 {
|
||||
SELECT * FROM x2;
|
||||
} {3}
|
||||
|
||||
do_execsql_test 1.7 {
|
||||
WITH x1 AS (SELECT * FROM t1)
|
||||
SELECT (SELECT sum(a) FROM x1), (SELECT max(a) FROM x1);
|
||||
} {3 2}
|
||||
|
||||
do_execsql_test 1.8 {
|
||||
WITH x1 AS (SELECT * FROM t1)
|
||||
SELECT (SELECT sum(a) FROM x1), (SELECT max(a) FROM x1), a FROM x1;
|
||||
} {3 2 1 3 2 2}
|
||||
|
||||
do_execsql_test 1.9 {
|
||||
WITH
|
||||
i(x) AS (
|
||||
WITH
|
||||
j(x) AS ( SELECT * FROM i ),
|
||||
i(x) AS ( SELECT * FROM t1 )
|
||||
SELECT * FROM j
|
||||
)
|
||||
SELECT * FROM i;
|
||||
} {1 2}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Check that variables can be used in CTEs.
|
||||
#
|
||||
set ::min [expr 3]
|
||||
set ::max [expr 9]
|
||||
do_execsql_test 2.1 {
|
||||
WITH i(x) AS (
|
||||
VALUES($min) UNION ALL SELECT x+1 FROM i WHERE x < $max
|
||||
)
|
||||
SELECT * FROM i;
|
||||
} {3 4 5 6 7 8 9}
|
||||
|
||||
do_execsql_test 2.2 {
|
||||
WITH i(x) AS (
|
||||
VALUES($min) UNION ALL SELECT x+1 FROM i WHERE x < $max
|
||||
)
|
||||
SELECT x FROM i JOIN i AS j USING (x);
|
||||
} {3 4 5 6 7 8 9}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Check that circular references are rejected.
|
||||
#
|
||||
do_catchsql_test 3.1 {
|
||||
WITH i(x, y) AS ( VALUES(1, (SELECT x FROM i)) )
|
||||
SELECT * FROM i;
|
||||
} {1 {circular reference: i}}
|
||||
|
||||
do_catchsql_test 3.2 {
|
||||
WITH
|
||||
i(x) AS ( SELECT * FROM j ),
|
||||
j(x) AS ( SELECT * FROM k ),
|
||||
k(x) AS ( SELECT * FROM i )
|
||||
SELECT * FROM i;
|
||||
} {1 {circular reference: i}}
|
||||
|
||||
do_catchsql_test 3.3 {
|
||||
WITH
|
||||
i(x) AS ( SELECT * FROM (SELECT * FROM j) ),
|
||||
j(x) AS ( SELECT * FROM (SELECT * FROM i) )
|
||||
SELECT * FROM i;
|
||||
} {1 {circular reference: i}}
|
||||
|
||||
do_catchsql_test 3.4 {
|
||||
WITH
|
||||
i(x) AS ( SELECT * FROM (SELECT * FROM j) ),
|
||||
j(x) AS ( SELECT * FROM (SELECT * FROM i) )
|
||||
SELECT * FROM j;
|
||||
} {1 {circular reference: j}}
|
||||
|
||||
do_catchsql_test 3.5 {
|
||||
WITH
|
||||
i(x) AS (
|
||||
WITH j(x) AS ( SELECT * FROM i )
|
||||
SELECT * FROM j
|
||||
)
|
||||
SELECT * FROM i;
|
||||
} {1 {circular reference: i}}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Try empty and very long column lists.
|
||||
#
|
||||
do_catchsql_test 4.1 {
|
||||
WITH x() AS ( SELECT 1,2,3 )
|
||||
SELECT * FROM x;
|
||||
} {1 {near ")": syntax error}}
|
||||
|
||||
proc genstmt {n} {
|
||||
for {set i 1} {$i<=$n} {incr i} {
|
||||
lappend cols "c$i"
|
||||
lappend vals $i
|
||||
}
|
||||
return "
|
||||
WITH x([join $cols ,]) AS (SELECT [join $vals ,])
|
||||
SELECT (c$n == $n) FROM x
|
||||
"
|
||||
}
|
||||
|
||||
do_execsql_test 4.2 [genstmt 10] 1
|
||||
do_execsql_test 4.3 [genstmt 100] 1
|
||||
do_execsql_test 4.4 [genstmt 255] 1
|
||||
set nLimit [sqlite3_limit db SQLITE_LIMIT_COLUMN -1]
|
||||
do_execsql_test 4.5 [genstmt [expr $nLimit-1]] 1
|
||||
do_execsql_test 4.6 [genstmt $nLimit] 1
|
||||
do_catchsql_test 4.7 [genstmt [expr $nLimit+1]] {1 {too many columns in index}}
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
Reference in New Issue
Block a user