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.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c
index 236222d72a1..f26c883c67d 100644
--- a/src/backend/executor/nodeSubplan.c
+++ b/src/backend/executor/nodeSubplan.c
@@ -160,7 +160,7 @@ ExecHashSubPlan(SubPlanState *node,
FindTupleHashEntry(node->hashtable,
slot,
node->cur_eq_comp,
- node->lhs_hash_funcs) != NULL)
+ node->lhs_hash_expr) != NULL)
{
ExecClearTuple(slot);
return BoolGetDatum(true);
@@ -857,7 +857,6 @@ ExecInitSubPlan(SubPlan *subplan, PlanState *parent)
sstate->tab_eq_funcoids = NULL;
sstate->tab_hash_funcs = NULL;
sstate->tab_collations = NULL;
- sstate->lhs_hash_funcs = NULL;
sstate->cur_eq_funcs = NULL;
/*
@@ -897,6 +896,7 @@ ExecInitSubPlan(SubPlan *subplan, PlanState *parent)
TupleDesc tupDescRight;
Oid *cross_eq_funcoids;
TupleTableSlot *slot;
+ FmgrInfo *lhs_hash_funcs;
List *oplist,
*lefttlist,
*righttlist;
@@ -953,7 +953,7 @@ ExecInitSubPlan(SubPlan *subplan, PlanState *parent)
sstate->tab_eq_funcoids = (Oid *) palloc(ncols * sizeof(Oid));
sstate->tab_collations = (Oid *) palloc(ncols * sizeof(Oid));
sstate->tab_hash_funcs = (FmgrInfo *) palloc(ncols * sizeof(FmgrInfo));
- sstate->lhs_hash_funcs = (FmgrInfo *) palloc(ncols * sizeof(FmgrInfo));
+ 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));
@@ -1003,7 +1003,7 @@ ExecInitSubPlan(SubPlan *subplan, PlanState *parent)
&left_hashfn, &right_hashfn))
elog(ERROR, "could not find hash function for hash operator %u",
opexpr->opno);
- fmgr_info(left_hashfn, &sstate->lhs_hash_funcs[i - 1]);
+ fmgr_info(left_hashfn, &lhs_hash_funcs[i - 1]);
fmgr_info(right_hashfn, &sstate->tab_hash_funcs[i - 1]);
/* Set collation */
@@ -1039,6 +1039,16 @@ ExecInitSubPlan(SubPlan *subplan, PlanState *parent)
sstate->planstate,
NULL);
+ /* Build the ExprState for generating hash values */
+ sstate->lhs_hash_expr = ExecBuildHash32FromAttrs(tupDescLeft,
+ &TTSOpsVirtual,
+ lhs_hash_funcs,
+ sstate->tab_collations,
+ sstate->numCols,
+ sstate->keyColIdx,
+ parent,
+ 0);
+
/*
* Create comparator for lookups of rows in the table (potentially
* cross-type comparisons).