diff options
author | Noah Misch <noah@leadboat.com> | 2013-07-16 20:15:36 -0400 |
---|---|---|
committer | Noah Misch <noah@leadboat.com> | 2013-07-16 20:15:36 -0400 |
commit | b560ec1b0d7b910ce13edc51ffaafaca72136e3b (patch) | |
tree | ae5d80c94681788fd214efe6d61425089850781e /src/backend/parser/parse_collate.c | |
parent | 7a8e9f298e7b8158296e1ea72ca8987323c10edf (diff) | |
download | postgresql-b560ec1b0d7b910ce13edc51ffaafaca72136e3b.tar.gz postgresql-b560ec1b0d7b910ce13edc51ffaafaca72136e3b.zip |
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.
Diffstat (limited to 'src/backend/parser/parse_collate.c')
-rw-r--r-- | src/backend/parser/parse_collate.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/backend/parser/parse_collate.c b/src/backend/parser/parse_collate.c index 80f6ac7c085..fe57c596183 100644 --- a/src/backend/parser/parse_collate.c +++ b/src/backend/parser/parse_collate.c @@ -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: |