summaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_agg.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2023-03-13 12:40:28 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2023-03-13 12:40:28 -0400
commit30dbdbe75384bcb034172c781b24bc982434a967 (patch)
treeabbade9a7c394f76d5e298a55c0d32c86bd1fc04 /src/backend/parser/parse_agg.c
parent9f8377f7a27910bf0f35bf5169a8046731948a79 (diff)
downloadpostgresql-30dbdbe75384bcb034172c781b24bc982434a967.tar.gz
Fix failure to detect some cases of improperly-nested aggregates.
check_agg_arguments_walker() supposed that it needn't descend into the arguments of a lower-level aggregate function, but this is just wrong in the presence of multiple levels of sub-select. The oversight would lead to executor failures on queries that should be rejected. (Prior to v11, they actually were rejected, thanks to a "redundant" execution-time check.) Per bug #17835 from Anban Company. Back-patch to all supported branches. Discussion: https://postgr.es/m/17835-4f29f3098b2d0ba4@postgresql.org
Diffstat (limited to 'src/backend/parser/parse_agg.c')
-rw-r--r--src/backend/parser/parse_agg.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c
index 4fbf80c271..85cd47b7ae 100644
--- a/src/backend/parser/parse_agg.c
+++ b/src/backend/parser/parse_agg.c
@@ -736,8 +736,7 @@ check_agg_arguments_walker(Node *node,
context->min_agglevel > agglevelsup)
context->min_agglevel = agglevelsup;
}
- /* no need to examine args of the inner aggregate */
- return false;
+ /* Continue and descend into subtree */
}
if (IsA(node, GroupingFunc))
{