* Aggref is a special case because expressions used only for ordering * shouldn't be taken to conflict with each other or with regular args, * indeed shouldn't affect the aggregate's result collation at all. * We handle this by applying assign_expr_collations() to them rather than * passing down our loccontext. * * Note that we recurse to each TargetEntry, not directly to its contained * ex
| 883 | * contain only SortGroupClause nodes which we need not process. |
| 884 | */ |
| 885 | static void |
| 886 | assign_aggregate_collations(Aggref *aggref, |
| 887 | assign_collations_context *loccontext) |
| 888 | { |
| 889 | ListCell *lc; |
| 890 | |
| 891 | /* Plain aggregates have no direct args */ |
| 892 | Assert(aggref->aggdirectargs == NIL); |
| 893 | |
| 894 | /* Process aggregated args, holding resjunk ones at arm's length */ |
| 895 | foreach(lc, aggref->args) |
| 896 | { |
| 897 | TargetEntry *tle = lfirst_node(TargetEntry, lc); |
| 898 | |
| 899 | if (tle->resjunk) |
| 900 | assign_expr_collations(loccontext->pstate, (Node *) tle); |
| 901 | else |
| 902 | (void) assign_collations_walker((Node *) tle, loccontext); |
| 903 | } |
| 904 | } |
| 905 | |
| 906 | /* |
| 907 | * For ordered-set aggregates, it's somewhat unclear how best to proceed. |
no test coverage detected