]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add a few more CTE test cases to closure.test.
authordrh <drh@noemail.net>
Fri, 24 Jan 2014 15:42:51 +0000 (15:42 +0000)
committerdrh <drh@noemail.net>
Fri, 24 Jan 2014 15:42:51 +0000 (15:42 +0000)
FossilOrigin-Name: 1b6405d9788c1bb89761b2bcdce560a5020ff503

manifest
manifest.uuid
test/closure01.test

index 2336aab937b7096accedd9b0ebe0c961ec73ee8e..275452cb2897908b0fb833b0a124a55607ee09c2 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\stest\scases\sthat\scompare\sthe\sperformance\sof\sthe\stransitive_closure\nvirtual\stable\sagain\scommon\stable\sexpressions\sfor\swalking\sa\stree.
-D 2014-01-24T14:37:44.938
+C Add\sa\sfew\smore\sCTE\stest\scases\sto\sclosure.test.
+D 2014-01-24T15:42:51.397
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -372,7 +372,7 @@ F test/capi3e.test ad90088b18b0367125ff2d4b5400153fd2f99aab
 F test/cast.test 4c275cbdc8202d6f9c54a3596701719868ac7dc3
 F test/check.test 5831ddb6f2c687782eaf2e1a07b6e17f24c4f763
 F test/close.test 340bd24cc58b16c6bc01967402755027c37eb815
-F test/closure01.test 52036bd5f5d1734f41ba708e9038198aa274156a
+F test/closure01.test b1703ba40639cfc9b295cf478d70739415eec6a4
 F test/coalesce.test cee0dccb9fbd2d494b77234bccf9dc6c6786eb91
 F test/collate1.test 73b91005f264b7c403e2d63a6708d150679ac99a
 F test/collate2.test 9aaa410a00734e48bcb27f3872617d6f69b2a621
@@ -1152,7 +1152,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 83b0b2916589db0184435dbd4c304387f393ed60
-R f85f8ae6263bf3d6f45ffff44c95c74a
+P 9a23f020e8ed0e7a1ad227b4ab379fdf5e2de222
+R f2060716c43f1dee6a2c1f879c1129f5
 U drh
-Z be990f0e27dcbfb4abd20beb041780d7
+Z 7914ad8fe58314f1f17f9965f9b13c5e
index cc3b6b68307b6b52a80add5b41610f6037113ea5..6ca0ece42ca2d3f4c3afe2d2414d389dc1ef250d 100644 (file)
@@ -1 +1 @@
-9a23f020e8ed0e7a1ad227b4ab379fdf5e2de222
\ No newline at end of file
+1b6405d9788c1bb89761b2bcdce560a5020ff503
\ No newline at end of file
index 346ea76e8c444b175e5f49562d3e2fd207558b20..213ef4e9666e112f95123c97a934fa67eccc5b0f 100644 (file)
@@ -47,9 +47,20 @@ do_timed_execsql_test 1.1-cte {
 } {/1 0 1 17 2 1 4 2 8 3 16 4 .* 65536 16/}
 
 # descendents of 32768
-do_execsql_test 1.2 {
+do_timed_execsql_test 1.2 {
   SELECT * FROM cx WHERE root=32768 ORDER BY id;
 } {32768 0 65536 1 65537 1 131072 2}
+do_timed_execsql_test 1.2-cte {
+  WITH RECURSIVE
+    below(id,depth) AS (
+      VALUES(32768,0)
+       UNION ALL
+      SELECT t1.x, below.depth+1
+        FROM t1 JOIN below on t1.y=below.id
+       WHERE below.depth<2
+    )
+  SELECT id, depth FROM below ORDER BY id;
+} {32768 0 65536 1 65537 1 131072 2}
 
 # descendents of 16384
 do_timed_execsql_test 1.3 {
@@ -76,19 +87,41 @@ do_execsql_test 1.4 {
 } {32768 1 {} t1 x y 32769 1 {} t1 x y}
 
 # great-grandparent of 16384
-do_execsql_test 1.5 {
+do_timed_execsql_test 1.5 {
   SELECT id, depth, root, tablename, idcolumn, parentcolumn FROM cx
    WHERE root=16384
      AND depth=3
      AND idcolumn='Y'
      AND parentcolumn='X';
 } {2048 3 {} t1 Y X}
+do_timed_execsql_test 1.5-cte {
+  WITH RECURSIVE
+    above(id,depth) AS (
+      VALUES(16384,0)
+      UNION ALL
+      SELECT t1.y, above.depth+1
+        FROM t1 JOIN above ON t1.x=above.id
+       WHERE above.depth<3
+    )
+  SELECT id FROM above WHERE depth=3;
+} {2048}
 
 # depth<5
-do_execsql_test 1.6 {
+do_timed_execsql_test 1.6 {
   SELECT count(*), depth FROM cx WHERE root=1 AND depth<5
    GROUP BY depth ORDER BY 1;
 } {1 0 2 1 4 2 8 3 16 4}
+do_timed_execsql_test 1.6-cte {
+  WITH RECURSIVE
+    below(id,depth) AS (
+      VALUES(1,0)
+      UNION ALL
+      SELECT t1.x, below.depth+1
+        FROM t1 JOIN below ON t1.y=below.id
+       WHERE below.depth<4
+    )
+  SELECT count(*), depth FROM below GROUP BY depth ORDER BY 1;
+} {1 0 2 1 4 2 8 3 16 4}
 
 # depth<=5
 do_execsql_test 1.7 {
@@ -109,9 +142,20 @@ do_execsql_test 1.9 {
 } {8 3 16 4 32 5}
 
 # depth==5 with min() and max()
-do_execsql_test 1.10 {
+do_timed_execsql_test 1.10 {
   SELECT count(*), min(id), max(id) FROM cx WHERE root=1 AND depth=5;
 } {32 32 63}
+do_timed_execsql_test 1.10-cte {
+  WITH RECURSIVE
+    below(id,depth) AS (
+      VALUES(1,0)
+      UNION ALL
+      SELECT t1.x, below.depth+1
+        FROM t1 JOIN below ON t1.y=below.id
+       WHERE below.depth<5
+    )
+  SELECT count(*), min(id), max(id) FROM below WHERE depth=5;
+} {32 32 63}
 
 # Create a much smaller table t2 with only 32 elements 
 db eval {