Skip to content

Commit dc777f9

Browse files
committed
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 0436f6b by copying the logic for window functions ... but that was broken too, and had been since commit eaccfde. Repair both cases in HEAD, and the window function case back to 9.3. 9.2 gets this right.
1 parent 47fec42 commit dc777f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/parser/parse_agg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ check_agg_arguments_walker(Node *node,
508508
return false;
509509
}
510510
/* We can throw error on sight for a window function */
511-
if (IsA(node, WindowFunc))
511+
if (IsA(node, WindowFunc) && context->sublevels_up == 0)
512512
ereport(ERROR,
513513
(errcode(ERRCODE_GROUPING_ERROR),
514514
errmsg("aggregate function calls cannot contain window function calls"),

0 commit comments

Comments
 (0)