Skip to content

Commit 83b3ef3

Browse files
author
Rafa de la Torre
committed
Fix collation safety rules for aggregations
For default input collation, inner_cxt.state is marked as FDW_COLLATE_NONE. There's the situation in which agg.collation == DEFAULT_COLLATION_OID and thus it should be safe to push down the aggregation.
1 parent 424820c commit 83b3ef3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

contrib/postgres_fdw/deparse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ foreign_expr_walker(Node *node,
752752
* If aggregate's input collation is not derived from a
753753
* foreign Var, it can't be sent to remote.
754754
*/
755-
if (agg->inputcollid == InvalidOid)
755+
if (agg->inputcollid == InvalidOid || inner_cxt.state == FDW_COLLATE_NONE)
756756
/* OK, inputs are all noncollatable */ ;
757757
else if (inner_cxt.state != FDW_COLLATE_SAFE ||
758758
agg->inputcollid != inner_cxt.collation)

0 commit comments

Comments
 (0)