mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Revert "Do execGrouping.c via expression eval machinery."
This reverts commit 773aec7aa9
.
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.
This commit is contained in:
@ -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));
|
||||
}
|
||||
|
Reference in New Issue
Block a user