You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-db/sqlite/files/sqlite-3.25.2-full_archive-...

50 lines
1.4 KiB

https://sqlite.org/src/info/e8275b415a2f03bee
https://sqlite.org/src/info/7fc2994434c7d9ed
--- /src/select.c
+++ /src/select.c
@@ -2318,6 +2318,13 @@
Expr *pLimit; /* Saved LIMIT and OFFSET */
int regLimit, regOffset; /* Registers used by LIMIT and OFFSET */
+#ifndef SQLITE_OMIT_WINDOWFUNC
+ if( p->pWin ){
+ sqlite3ErrorMsg(pParse, "cannot use window functions in recursive queries");
+ return;
+ }
+#endif
+
/* Obtain authorization to do a recursive query */
if( sqlite3AuthCheck(pParse, SQLITE_RECURSIVE, 0, 0, 0) ) return;
--- /test/with1.test
+++ /test/with1.test
@@ -865,6 +865,27 @@
SELECT * FROM i;
} {1 {recursive aggregate queries not supported}}
+# Or window-function recursive queries. Ticket e8275b41.
+#
+ifcapable windowfunc {
+ do_catchsql_test 16.2 {
+ WITH RECURSIVE
+ i(x) AS (VALUES(1) UNION SELECT count(*) OVER () FROM i)
+ SELECT * FROM i;
+ } {1 {cannot use window functions in recursive queries}}
+ do_catchsql_test 16.3 {
+ WITH RECURSIVE
+ t(id, parent) AS (VALUES(1,2)),
+ q(id, parent, rn) AS (
+ VALUES(1,2,3)
+ UNION ALL
+ SELECT t.*, ROW_NUMBER() OVER (ORDER BY t.id) AS rn
+ FROM q JOIN t ON t.parent = q.id
+ )
+ SELECT * FROM q;
+ } {1 {cannot use window functions in recursive queries}}
+}
+
#-------------------------------------------------------------------------
do_execsql_test 17.1 {
WITH x(a) AS (