Skip to content

Commit a972500

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 == innert_cxt.collation == DEFAULT_COLLATION_OID and thus it should be safe to push down the aggregation when FDW_COLLATE_NONE and FDW_COLLATE_SAFE. This fixes it by checking against FDW_COLLATE_UNSAFE.
1 parent 424820c commit a972500

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
@@ -754,7 +754,7 @@ foreign_expr_walker(Node *node,
754754
*/
755755
if (agg->inputcollid == InvalidOid)
756756
/* OK, inputs are all noncollatable */ ;
757-
else if (inner_cxt.state != FDW_COLLATE_SAFE ||
757+
else if (inner_cxt.state == FDW_COLLATE_UNSAFE ||
758758
agg->inputcollid != inner_cxt.collation)
759759
return false;
760760

0 commit comments

Comments
 (0)