Skip traversing children of aggregate functions

Aggregate functions cannot be nested, and this is validated during the
translation of aggregate function arguments. Therefore, traversing their
child expressions is unnecessary.
This commit is contained in:
Piotr Rzysko
2025-09-01 16:16:14 +02:00
parent 9b742a64c2
commit 569e41cb1e
2 changed files with 12 additions and 1 deletions

View File

@@ -191,3 +191,11 @@ do_execsql_test_error select-scalar-func-star {
do_execsql_test_error select-scalar-func-star-in-expression {
SELECT CASE WHEN abs(*) > 0 THEN 1 ELSE 0 END FROM users;
} {.*(Invalid aggregate function|wrong number of arguments to function).*}
do_execsql_test_error_content select-nested-agg-func {
SELECT max(abs(sum(age))), sum(age) FROM users;
} {"misuse of aggregate function"}
do_execsql_test_error_content select-nested-agg-func-in-expression {
SELECT CASE WHEN max(abs(sum(age))) > 0 THEN 1 ELSE 0 END, sum(age) FROM users;
} {"misuse of aggregate function"}