mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
Implement the FILTER clause for aggregate function calls.
This is SQL-standard with a few extensions, namely support for subqueries and outer references in clause expressions. catversion bump due to change in Aggref and WindowFunc. David Fetter, reviewed by Dean Rasheed.
This commit is contained in:
@ -575,6 +575,10 @@ assign_collations_walker(Node *node, assign_collations_context *context)
|
||||
* the case above for T_TargetEntry will apply
|
||||
* appropriate checks to agg ORDER BY items.
|
||||
*
|
||||
* Likewise, we assign collations for the (bool)
|
||||
* expression in aggfilter, independently of any
|
||||
* other args.
|
||||
*
|
||||
* We need not recurse into the aggorder or
|
||||
* aggdistinct lists, because those contain only
|
||||
* SortGroupClause nodes which we need not
|
||||
@ -595,6 +599,24 @@ assign_collations_walker(Node *node, assign_collations_context *context)
|
||||
(void) assign_collations_walker((Node *) tle,
|
||||
&loccontext);
|
||||
}
|
||||
|
||||
assign_expr_collations(context->pstate,
|
||||
(Node *) aggref->aggfilter);
|
||||
}
|
||||
break;
|
||||
case T_WindowFunc:
|
||||
{
|
||||
/*
|
||||
* WindowFunc requires special processing only for
|
||||
* its aggfilter clause, as for aggregates.
|
||||
*/
|
||||
WindowFunc *wfunc = (WindowFunc *) node;
|
||||
|
||||
(void) assign_collations_walker((Node *) wfunc->args,
|
||||
&loccontext);
|
||||
|
||||
assign_expr_collations(context->pstate,
|
||||
(Node *) wfunc->aggfilter);
|
||||
}
|
||||
break;
|
||||
case T_CaseExpr:
|
||||
|
Reference in New Issue
Block a user