aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authordan <dan@noemail.net>2020-01-01 20:17:15 +0000
committerdan <dan@noemail.net>2020-01-01 20:17:15 +0000
commit4ea562ee7007f184b53faa4a2bbdbfa70d0dbe9c (patch)
treed39b2c23cbcc1db8377a124eae6cbb1efa73362f /test
parentaef81674211ab2f0f93852e3e9ca3bebb7e77c0b (diff)
downloadsqlite-4ea562ee7007f184b53faa4a2bbdbfa70d0dbe9c.tar.gz
sqlite-4ea562ee7007f184b53faa4a2bbdbfa70d0dbe9c.zip
Ensure that when code for a scalar SELECT featuring window functions is generated more than once by the planner, separate ephemeral tables are opened for each instance.
FossilOrigin-Name: ce1417325273aba866767349b55d9bbfb61a08e716bebda2122918a9657ee38c
Diffstat (limited to 'test')
-rw-r--r--test/window1.test23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/window1.test b/test/window1.test
index 0b7884784..a2d26a2f7 100644
--- a/test/window1.test
+++ b/test/window1.test
@@ -1531,4 +1531,27 @@ do_execsql_test 45.2 {
);
} {2000 2000 10000}
+#-------------------------------------------------------------------------
+reset_db
+do_execsql_test 46.1 {
+ CREATE TABLE t1 (a);
+ CREATE INDEX i1 ON t1(a);
+
+ INSERT INTO t1 VALUES (10);
+}
+
+do_execsql_test 46.2 {
+ SELECT (SELECT sum(a) OVER(ORDER BY a)) FROM t1
+} 10
+
+do_execsql_test 46.3 {
+ SELECT * FROM t1 WHERE (SELECT sum(a) OVER(ORDER BY a));
+} 10
+
+do_execsql_test 46.4 {
+ SELECT * FROM t1 NATURAL JOIN t1
+ WHERE a=1
+ OR ((SELECT sum(a)OVER(ORDER BY a)) AND a<=10)
+} 10
+
finish_test