aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeSubplan.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor/nodeSubplan.c')
-rw-r--r--src/backend/executor/nodeSubplan.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c
index 9564d54ed4c..35e45671d4c 100644
--- a/src/backend/executor/nodeSubplan.c
+++ b/src/backend/executor/nodeSubplan.c
@@ -855,6 +855,7 @@ ExecInitSubPlan(SubPlan *subplan, PlanState *parent)
i;
TupleDesc tupDescLeft;
TupleDesc tupDescRight;
+ Oid *cross_eq_funcoids;
TupleTableSlot *slot;
List *oplist,
*lefttlist,
@@ -917,6 +918,9 @@ ExecInitSubPlan(SubPlan *subplan, PlanState *parent)
sstate->tab_eq_funcs = (FmgrInfo *) palloc(ncols * sizeof(FmgrInfo));
sstate->lhs_hash_funcs = (FmgrInfo *) palloc(ncols * sizeof(FmgrInfo));
sstate->cur_eq_funcs = (FmgrInfo *) palloc(ncols * sizeof(FmgrInfo));
+ /* we'll need the cross-type equality fns below, but not in sstate */
+ cross_eq_funcoids = (Oid *) palloc(ncols * sizeof(Oid));
+
i = 1;
foreach(l, oplist)
{
@@ -946,7 +950,7 @@ ExecInitSubPlan(SubPlan *subplan, PlanState *parent)
righttlist = lappend(righttlist, tle);
/* Lookup the equality function (potentially cross-type) */
- sstate->tab_eq_funcoids[i - 1] = opexpr->opfuncid;
+ cross_eq_funcoids[i - 1] = opexpr->opfuncid;
fmgr_info(opexpr->opfuncid, &sstate->cur_eq_funcs[i - 1]);
fmgr_info_set_expr((Node *) opexpr, &sstate->cur_eq_funcs[i - 1]);
@@ -955,7 +959,9 @@ ExecInitSubPlan(SubPlan *subplan, PlanState *parent)
NULL, &rhs_eq_oper))
elog(ERROR, "could not find compatible hash operator for operator %u",
opexpr->opno);
- fmgr_info(get_opcode(rhs_eq_oper), &sstate->tab_eq_funcs[i - 1]);
+ sstate->tab_eq_funcoids[i - 1] = get_opcode(rhs_eq_oper);
+ fmgr_info(sstate->tab_eq_funcoids[i - 1],
+ &sstate->tab_eq_funcs[i - 1]);
/* Lookup the associated hash functions */
if (!get_op_hash_functions(opexpr->opno,
@@ -994,14 +1000,13 @@ ExecInitSubPlan(SubPlan *subplan, PlanState *parent)
/*
* Create comparator for lookups of rows in the table (potentially
- * across-type comparison).
+ * cross-type comparisons).
*/
sstate->cur_eq_comp = ExecBuildGroupingEqual(tupDescLeft, tupDescRight,
ncols,
sstate->keyColIdx,
- sstate->tab_eq_funcoids,
+ cross_eq_funcoids,
parent);
-
}
return sstate;