summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-db/sqlite/files/sqlite-3.25.2-full_archive-disallow_window_functions_in_recursive_queries.patch')
-rw-r--r--dev-db/sqlite/files/sqlite-3.25.2-full_archive-disallow_window_functions_in_recursive_queries.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/dev-db/sqlite/files/sqlite-3.25.2-full_archive-disallow_window_functions_in_recursive_queries.patch b/dev-db/sqlite/files/sqlite-3.25.2-full_archive-disallow_window_functions_in_recursive_queries.patch
new file mode 100644
index 000000000000..6b34e2e4f9d8
--- /dev/null
+++ b/dev-db/sqlite/files/sqlite-3.25.2-full_archive-disallow_window_functions_in_recursive_queries.patch
@@ -0,0 +1,49 @@
+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 (