diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c index 429257f..596501f 100644 --- a/src/backend/optimizer/path/joinpath.c +++ b/src/backend/optimizer/path/joinpath.c @@ -435,6 +435,15 @@ paraminfo_get_equal_hashops(PlannerInfo *root, ParamPathInfo *param_info, else expr = (Node *) lsecond(opexpr->args); + /* + * Ensure the cache key exposes the clause's input collation, so + * that Memoize compares keys the same way the clause does. See + * comments for canonicalize_ec_expression. + */ + expr = (Node *) canonicalize_ec_expression((Expr *) expr, + exprType(expr), + opexpr->inputcollid); + *operators = lappend_oid(*operators, rinfo->hasheqoperator); *param_exprs = lappend(*param_exprs, expr);