diff options
author | Andres Freund <andres@anarazel.de> | 2018-02-15 22:39:18 -0800 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2018-02-15 22:39:18 -0800 |
commit | 2a41507dab0f293ff241fe8ae326065998668af8 (patch) | |
tree | 30fe1118750ea9c2805bd38a7485390f4d381715 /src/backend/executor/nodeUnique.c | |
parent | 773aec7aa98abd38d6d9435913bb8e14e392c274 (diff) | |
download | postgresql-2a41507dab0f293ff241fe8ae326065998668af8.tar.gz postgresql-2a41507dab0f293ff241fe8ae326065998668af8.zip |
Revert "Do execGrouping.c via expression eval machinery."
This reverts commit 773aec7aa98abd38d6d9435913bb8e14e392c274.
There's an unresolved issue in the reverted commit: It only creates
one comparator function, but in for the nodeSubplan.c case we need
more (c.f. FindTupleHashEntry vs LookupTupleHashEntry calls in
nodeSubplan.c).
This isn't too difficult to fix, but it's not entirely trivial
either. The fact that the issue only causes breakage on 32bit systems
shows that the current test coverage isn't that great. To avoid
turning half the buildfarm red till those two issues are addressed,
revert.
Diffstat (limited to 'src/backend/executor/nodeUnique.c')
-rw-r--r-- | src/backend/executor/nodeUnique.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/backend/executor/nodeUnique.c b/src/backend/executor/nodeUnique.c index 9f823c58e1a..e330650593a 100644 --- a/src/backend/executor/nodeUnique.c +++ b/src/backend/executor/nodeUnique.c @@ -47,7 +47,7 @@ static TupleTableSlot * /* return: a tuple or NULL */ ExecUnique(PlanState *pstate) { UniqueState *node = castNode(UniqueState, pstate); - ExprContext *econtext = node->ps.ps_ExprContext; + Unique *plannode = (Unique *) node->ps.plan; TupleTableSlot *resultTupleSlot; TupleTableSlot *slot; PlanState *outerPlan; @@ -89,9 +89,10 @@ ExecUnique(PlanState *pstate) * If so then we loop back and fetch another new tuple from the * subplan. */ - econtext->ecxt_innertuple = slot; - econtext->ecxt_outertuple = resultTupleSlot; - if (!ExecQualAndReset(node->eqfunction, econtext)) + if (!execTuplesMatch(slot, resultTupleSlot, + plannode->numCols, plannode->uniqColIdx, + node->eqfunctions, + node->tempContext)) break; } @@ -128,9 +129,16 @@ ExecInitUnique(Unique *node, EState *estate, int eflags) uniquestate->ps.ExecProcNode = ExecUnique; /* - * create expression context + * Miscellaneous initialization + * + * Unique nodes have no ExprContext initialization because they never call + * ExecQual or ExecProject. But they do need a per-tuple memory context + * anyway for calling execTuplesMatch. */ - ExecAssignExprContext(estate, &uniquestate->ps); + uniquestate->tempContext = + AllocSetContextCreate(CurrentMemoryContext, + "Unique", + ALLOCSET_DEFAULT_SIZES); /* * Tuple table initialization @@ -152,12 +160,9 @@ ExecInitUnique(Unique *node, EState *estate, int eflags) /* * Precompute fmgr lookup data for inner loop */ - uniquestate->eqfunction = - execTuplesMatchPrepare(ExecGetResultType(outerPlanState(uniquestate)), - node->numCols, - node->uniqColIdx, - node->uniqOperators, - &uniquestate->ps); + uniquestate->eqfunctions = + execTuplesMatchPrepare(node->numCols, + node->uniqOperators); return uniquestate; } @@ -175,7 +180,7 @@ ExecEndUnique(UniqueState *node) /* clean up tuple table */ ExecClearTuple(node->ps.ps_ResultTupleSlot); - ExecFreeExprContext(&node->ps); + MemoryContextDelete(node->tempContext); ExecEndNode(outerPlanState(node)); } |