mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Fix an assert() in window.c that could fail with some obscure SELECT statements that use window functions.
FossilOrigin-Name: 83dc55679a91bf5d1d13706088ce58eed02b9aad1ad0ae237966e78e0d769663
This commit is contained in:
@ -1577,4 +1577,21 @@ do_catchsql_test 47.2 {
|
||||
OR (SELECT k FROM t2 WHERE (SELECT sum(a) OVER() FROM t1 GROUP BY 1));
|
||||
} {1 {misuse of window function sum()}}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 48.0 {
|
||||
CREATE TABLE t1(a);
|
||||
INSERT INTO t1 VALUES(1);
|
||||
INSERT INTO t1 VALUES(2);
|
||||
INSERT INTO t1 VALUES(3);
|
||||
SELECT (SELECT max(x)OVER(ORDER BY x) + min(x)OVER(ORDER BY x))
|
||||
FROM (SELECT (SELECT sum(a) FROM t1) AS x FROM t1);
|
||||
} {12 12 12}
|
||||
|
||||
do_execsql_test 48.1 {
|
||||
SELECT (SELECT max(x)OVER(ORDER BY x) + min(x)OVER(ORDER BY x))
|
||||
FROM (SELECT (SELECT sum(a) FROM t1 GROUP BY a) AS x FROM t1);
|
||||
} {2 2 2}
|
||||
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user