summaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_agg.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-06-27 17:51:11 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-06-27 17:51:11 -0400
commit9a2706572351d168af05216892a1f02a02c1a54f (patch)
tree7c16a88b1e499cda1b76785ceae0e3b5b35d88a6 /src/backend/parser/parse_agg.c
parentdc311b5bd3cfe0c98d7dca783e8880b1b2edda71 (diff)
Re-allow SRFs and window functions within sub-selects within aggregates.
check_agg_arguments_walker threw an error upon seeing a SRF or window function, but that is too aggressive: if the function is within a sub-select then it's perfectly fine. I broke the SRF case in commit 0436f6bde by copying the logic for window functions ... but that was broken too, and had been since commit eaccfded9. Repair both cases in HEAD, and the window function case back to 9.3. 9.2 gets this right.
Diffstat (limited to 'src/backend/parser/parse_agg.c')
-rw-r--r--src/backend/parser/parse_agg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c
index 81c1fb599e7..da99ed6f16b 100644
--- a/src/backend/parser/parse_agg.c
+++ b/src/backend/parser/parse_agg.c
@@ -684,7 +684,7 @@ check_agg_arguments_walker(Node *node,
/* Continue and descend into subtree */
}
/* We can throw error on sight for a window function */
- if (IsA(node, WindowFunc))
+ if (IsA(node, WindowFunc) && context->sublevels_up == 0)
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("aggregate function calls cannot contain window function calls"),