Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3a7bd59

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 df31a9f commit 3a7bd59

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
@@ -700,7 +700,7 @@ check_agg_arguments_walker(Node *node,
700700
/* Continue and descend into subtree */
701701
}
702702
/* We can throw error on sight for a window function */
703-
if (IsA(node, WindowFunc))
703+
if (IsA(node, WindowFunc) && context->sublevels_up == 0)
704704
ereport(ERROR,
705705
(errcode(ERRCODE_GROUPING_ERROR),
706706
errmsg("aggregate function calls cannot contain window function calls"),

0 commit comments

Comments
 (0)