aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2020-10-19 01:44:43 +0000
committerdrh <drh@noemail.net>2020-10-19 01:44:43 +0000
commit07d7a8dca99e84ce2f4c2d21e5ad55cd5a7bcc6d (patch)
tree7b343599de50a32019437100085d9daba96b9112
parent340558540e4799bbcb00ab901c327d5000054920 (diff)
downloadsqlite-07d7a8dca99e84ce2f4c2d21e5ad55cd5a7bcc6d.tar.gz
sqlite-07d7a8dca99e84ce2f4c2d21e5ad55cd5a7bcc6d.zip
New test cases for recursive CTEs with multiple recursive terms.
FossilOrigin-Name: cd5182bd6f5969ba0812275f471224908296960358013327cebbe0c52b820f04
-rw-r--r--manifest15
-rw-r--r--manifest.uuid2
-rw-r--r--test/with5.test98
3 files changed, 105 insertions, 10 deletions
diff --git a/manifest b/manifest
index 383daa906..97c7236c2 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Allow\smultiple\srecursive\sterms\sin\sthe\scompound\sSELECT\sof\sa\srecursive\sCTE.\nThis\sfacilitates\swriting\sa\squery\sto\sfind\sfind\sthe\sconnected\scomponents\sof\nan\sundirected\sgraph.
-D 2020-10-19T01:23:48.028
+C New\stest\scases\sfor\srecursive\sCTEs\swith\smultiple\srecursive\sterms.
+D 2020-10-19T01:44:43.359
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1765,7 +1765,7 @@ F test/with1.test 780be387f01e290e768bdfd1827280f9e37ba37223eb4736aba386864fac5a
F test/with2.test e0030e2f0267a910d6c0e4f46f2dfe941c1cc0d4f659ba69b3597728e7e8f1ab
F test/with3.test a261f0ea225c4af0ce6447f1157bb603959b2a665f14a03951c2883d2ef1c0f0
F test/with4.test 257be66c0c67fee1defbbac0f685c3465e2cad037f21ce65f23f86084f198205
-F test/with5.test 9bbf9823dace99ba8fd853ac0961c8f2e4a6df93a2b6846328b7d411a8540699
+F test/with5.test 6248213c41fab36290b5b73aa3f937309dfba337004d9d8434c3fabc8c7d4be8
F test/withM.test 693b61765f2b387b5e3e24a4536e2e82de15ff64
F test/without_rowid1.test e4034c0849ccc2e8bb749c69f15bd69bb9fcf8fe77e8d17ce02369604242fe83
F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99
@@ -1883,10 +1883,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P d6fac8a1d3efeb2c4f03dae437b5b314765c93770a70603803a8039291dbcabb
-R 8cbf46bb87a6f92c4e833b5518759227
-T *branch * cte-enhancement
-T *sym-cte-enhancement *
-T -sym-trunk *
+P 5481fa8c79c34f434e99ab633ff3d0942a309a74fb0cf38e3d3617b51d5d21dd
+R cc1b5ef6b23650be291ff908be8e5bec
U drh
-Z c8e202423f476b36d763c0220ea16f8f
+Z aa6b2a08977c7f837672db1a2a88d629
diff --git a/manifest.uuid b/manifest.uuid
index d4b492871..f6c9501e1 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-5481fa8c79c34f434e99ab633ff3d0942a309a74fb0cf38e3d3617b51d5d21dd \ No newline at end of file
+cd5182bd6f5969ba0812275f471224908296960358013327cebbe0c52b820f04 \ No newline at end of file
diff --git a/test/with5.test b/test/with5.test
index 77fc75af8..430c5f2de 100644
--- a/test/with5.test
+++ b/test/with5.test
@@ -93,4 +93,102 @@ do_execsql_test 114 {
SELECT x FROM closure ORDER BY x;
} {1 2 3 4 5 6 7 8 9 11 200 300 400}
+do_catchsql_test 120 {
+ WITH RECURSIVE closure(x) AS (
+ VALUES(1),(200),(300),(400)
+ UNION ALL
+ VALUES(2)
+ UNION ALL
+ SELECT bb FROM closure, link WHERE link.aa=closure.x
+ UNION
+ SELECT aa FROM link, closure WHERE link.bb=closure.x
+ )
+ SELECT x FROM closure ORDER BY x;
+} {1 {circular reference: closure}}
+do_catchsql_test 121 {
+ WITH RECURSIVE closure(x) AS (
+ VALUES(1),(200),(300),(400)
+ UNION ALL
+ VALUES(2)
+ UNION
+ SELECT bb FROM closure, link WHERE link.aa=closure.x
+ UNION ALL
+ SELECT aa FROM link, closure WHERE link.bb=closure.x
+ )
+ SELECT x FROM closure ORDER BY x;
+} {1 {circular reference: closure}}
+
+do_execsql_test 130 {
+ WITH RECURSIVE closure(x) AS (
+ SELECT 1 AS x
+ UNION
+ SELECT aa FROM link JOIN closure ON bb=x
+ UNION
+ SELECT bb FROM link JOIN closure on aa=x
+ ORDER BY x LIMIT 4
+ )
+ SELECT * FROM closure;
+} {1 3 5 7}
+do_execsql_test 131 {
+ WITH RECURSIVE closure(x) AS (
+ SELECT 1 AS x
+ UNION ALL
+ SELECT 2
+ UNION
+ SELECT aa FROM link JOIN closure ON bb=x
+ UNION
+ SELECT bb FROM link JOIN closure on aa=x
+ ORDER BY x LIMIT 4
+ )
+ SELECT * FROM closure;
+} {1 2 3 4}
+
+do_execsql_test 200 {
+ CREATE TABLE linkA(aa1,aa2);
+ INSERT INTO linkA(aa1,aa2) VALUES(1,3),(5,7),(9,11);
+ CREATE TABLE linkB(bb1,bb2);
+ INSERT INTO linkB(bb1,bb2) VALUES(7,9),(11,13),(3,5);
+ CREATE TABLE linkC(cc1,cc2);
+ INSERT INTO linkC(cc1,cc2) VALUES(1,2),(2,4),(6,8);
+ CREATE TABLE linkD(dd1,dd2);
+ INSERT INTO linkD(dd1,dd2) VALUES(4,6),(100,110);
+} {}
+do_execsql_test 210 {
+ WITH RECURSIVE closure(x) AS (
+ VALUES(1)
+ UNION ALL
+ SELECT aa2 FROM linkA JOIN closure ON x=aa1
+ UNION ALL
+ SELECT bb2 FROM linkB JOIN closure ON x=bb1
+ UNION ALL
+ SELECT cc2 FROM linkC JOIN closure ON x=cc1
+ UNION ALL
+ SELECT dd2 FROM linkD JOIN closure ON x=dd1
+ )
+ SELECT x FROM closure ORDER BY +x;
+} {1 2 3 4 5 6 7 8 9 11 13}
+do_execsql_test 220 {
+ CREATE TABLE linkA_ipk(aa1 INTEGER PRIMARY KEY,aa2);
+ INSERT INTO linkA_ipk(aa1,aa2) SELECT aa1, aa2 FROM linkA;
+ CREATE TABLE linkB_ipk(bb1 INTEGER PRIMARY KEY,bb2);
+ INSERT INTO linkB_ipk(bb1,bb2) SELECT bb1, bb2 FROM linkB;
+ CREATE TABLE linkC_ipk(cc1 INTEGER PRIMARY KEY,cc2);
+ INSERT INTO linkC_ipk(cc1,cc2) SELECT cc1, cc2 FROM linkC;
+ CREATE TABLE linkD_ipk(dd1 INTEGER PRIMARY KEY,dd2);
+ INSERT INTO linkD_ipk(dd1,dd2) SELECT dd1, dd2 FROM linkD;
+ WITH RECURSIVE closure(x) AS (
+ VALUES(1)
+ UNION ALL
+ SELECT aa2 FROM linkA_ipk JOIN closure ON x=aa1
+ UNION ALL
+ SELECT bb2 FROM linkB_ipk JOIN closure ON x=bb1
+ UNION ALL
+ SELECT cc2 FROM linkC_ipk JOIN closure ON x=cc1
+ UNION ALL
+ SELECT dd2 FROM linkD_ipk JOIN closure ON x=dd1
+ )
+ SELECT x FROM closure ORDER BY +x;
+} {1 2 3 4 5 6 7 8 9 11 13}
+
+
finish_test