mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
When computing dependencies on WHERE-clause terms, be sure to take into
account the FILTER clause of aggregate functions. Problem reported by Manuel Rigger. FossilOrigin-Name: 3cc2b5709e66ef605c3b85ed13ae6cc9c3090e864ebc18859db36284b8f715b6
This commit is contained in:
@ -1329,6 +1329,22 @@ do_execsql_test 37.20 {
|
||||
SELECT c FROM v0 WHERE c BETWEEN -10 AND 20;
|
||||
} {}
|
||||
|
||||
|
||||
# 2019-20-20 mrigger reported problem with a FILTER clause on an aggregate
|
||||
# in a join.
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 38.10 {
|
||||
CREATE TABLE t0(c0);
|
||||
CREATE TABLE t1(c0, c1 UNIQUE);
|
||||
INSERT INTO t0(c0) VALUES(1);
|
||||
INSERT INTO t1(c0,c1) VALUES(2,3);
|
||||
SELECT COUNT(*) FROM t0, t1 WHERE (SELECT AVG(0) FILTER(WHERE t1.c1));
|
||||
} {0}
|
||||
do_execsql_test 38.20 {
|
||||
SELECT COUNT(*), AVG(1) FILTER(WHERE t1.c1) FROM t0, t1;
|
||||
} {1 1.0}
|
||||
do_execsql_test 38.30 {
|
||||
SELECT COUNT(*) FROM t0, t1 WHERE (SELECT AVG(1) FILTER(WHERE t1.c1));
|
||||
} {1}
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user