1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

When rewriting a query for window functions, if the rewrite changes the

depth of TK_AGG_FUNCTION nodes, be sure to adjust the Expr.op2 field
appropriately.  Fix for ticket [7a5279a25c57adf1]

FossilOrigin-Name: ad7bb70af9bb68d192137188bb2528f1e9e43ad164c925174ca1dafc9e1f5339
This commit is contained in:
drh
2020-05-24 03:38:37 +00:00
parent e40cc16b47
commit c37577bb2d
5 changed files with 50 additions and 9 deletions

View File

@ -1727,5 +1727,21 @@ do_execsql_test 52.4 {
4 938 938 4
}
# 2020-05-23
# ticket 7a5279a25c57adf1
#
reset_db
do_execsql_test 53.0 {
CREATE TABLE a(c UNIQUE);
INSERT INTO a VALUES(4),(0),(9),(-9);
SELECT a.c
FROM a
JOIN a AS b ON a.c=4
JOIN a AS e ON a.c=e.c
WHERE a.c=(SELECT (SELECT coalesce(lead(2) OVER(),0) + sum(d.c))
FROM a AS d
WHERE a.c);
} {4 4 4 4}
finish_test