1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

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
This commit is contained in:
dan
2020-01-01 20:17:15 +00:00
parent aef8167421
commit 4ea562ee70
6 changed files with 44 additions and 18 deletions

View File

@ -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