mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Extend the ExecInitNode API so that plan nodes receive a set of flag
bits indicating which optional capabilities can actually be exercised at runtime. This will allow Sort and Material nodes, and perhaps later other nodes, to avoid unnecessary overhead in common cases. This commit just adds the infrastructure and arranges to pass the correct flag values down to plan nodes; none of the actual optimizations are here yet. I'm committing this separately in case anyone wants to measure the added overhead. (It should be negligible.) Simon Riggs and Tom Lane
This commit is contained in:
@ -26,7 +26,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.267 2006/02/21 23:01:54 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.268 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -63,7 +63,7 @@ typedef struct evalPlanQual
|
||||
} evalPlanQual;
|
||||
|
||||
/* decls for local routines only used within this module */
|
||||
static void InitPlan(QueryDesc *queryDesc, bool explainOnly);
|
||||
static void InitPlan(QueryDesc *queryDesc, int eflags);
|
||||
static void initResultRelInfo(ResultRelInfo *resultRelInfo,
|
||||
Index resultRelationIndex,
|
||||
List *rangeTable,
|
||||
@ -105,15 +105,14 @@ static void EvalPlanQualStop(evalPlanQual *epq);
|
||||
* field of the QueryDesc is filled in to describe the tuples that will be
|
||||
* returned, and the internal fields (estate and planstate) are set up.
|
||||
*
|
||||
* If explainOnly is true, we are not actually intending to run the plan,
|
||||
* only to set up for EXPLAIN; so skip unwanted side-effects.
|
||||
* eflags contains flag bits as described in executor.h.
|
||||
*
|
||||
* NB: the CurrentMemoryContext when this is called will become the parent
|
||||
* of the per-query context used for this Executor invocation.
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
ExecutorStart(QueryDesc *queryDesc, bool explainOnly)
|
||||
ExecutorStart(QueryDesc *queryDesc, int eflags)
|
||||
{
|
||||
EState *estate;
|
||||
MemoryContext oldcontext;
|
||||
@ -124,9 +123,9 @@ ExecutorStart(QueryDesc *queryDesc, bool explainOnly)
|
||||
|
||||
/*
|
||||
* If the transaction is read-only, we need to check if any writes are
|
||||
* planned to non-temporary tables.
|
||||
* planned to non-temporary tables. EXPLAIN is considered read-only.
|
||||
*/
|
||||
if (XactReadOnly && !explainOnly)
|
||||
if (XactReadOnly && !(eflags & EXEC_FLAG_EXPLAIN_ONLY))
|
||||
ExecCheckXactReadOnly(queryDesc->parsetree);
|
||||
|
||||
/*
|
||||
@ -156,7 +155,7 @@ ExecutorStart(QueryDesc *queryDesc, bool explainOnly)
|
||||
/*
|
||||
* Initialize the plan state tree
|
||||
*/
|
||||
InitPlan(queryDesc, explainOnly);
|
||||
InitPlan(queryDesc, eflags);
|
||||
|
||||
MemoryContextSwitchTo(oldcontext);
|
||||
}
|
||||
@ -442,7 +441,7 @@ fail:
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
InitPlan(QueryDesc *queryDesc, bool explainOnly)
|
||||
InitPlan(QueryDesc *queryDesc, int eflags)
|
||||
{
|
||||
CmdType operation = queryDesc->operation;
|
||||
Query *parseTree = queryDesc->parsetree;
|
||||
@ -608,7 +607,7 @@ InitPlan(QueryDesc *queryDesc, bool explainOnly)
|
||||
* tree. This opens files, allocates storage and leaves us ready to start
|
||||
* processing tuples.
|
||||
*/
|
||||
planstate = ExecInitNode(plan, estate);
|
||||
planstate = ExecInitNode(plan, estate, eflags);
|
||||
|
||||
/*
|
||||
* Get the tuple descriptor describing the type of tuples to return. (this
|
||||
@ -727,7 +726,7 @@ InitPlan(QueryDesc *queryDesc, bool explainOnly)
|
||||
*/
|
||||
intoRelationDesc = NULL;
|
||||
|
||||
if (do_select_into && !explainOnly)
|
||||
if (do_select_into && !(eflags & EXEC_FLAG_EXPLAIN_ONLY))
|
||||
{
|
||||
char *intoName;
|
||||
Oid namespaceId;
|
||||
@ -2283,7 +2282,7 @@ EvalPlanQualStart(evalPlanQual *epq, EState *estate, evalPlanQual *priorepq)
|
||||
epqstate->es_tupleTable =
|
||||
ExecCreateTupleTable(estate->es_tupleTable->size);
|
||||
|
||||
epq->planstate = ExecInitNode(estate->es_topPlan, epqstate);
|
||||
epq->planstate = ExecInitNode(estate->es_topPlan, epqstate, 0);
|
||||
|
||||
MemoryContextSwitchTo(oldcontext);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execProcnode.c,v 1.52 2005/12/07 15:27:42 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execProcnode.c,v 1.53 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -45,7 +45,7 @@
|
||||
* DEPT EMP
|
||||
* (name = "shoe")
|
||||
*
|
||||
* ExecStart() is called first.
|
||||
* ExecutorStart() is called first.
|
||||
* It calls InitPlan() which calls ExecInitNode() on
|
||||
* the root of the plan -- the nest loop node.
|
||||
*
|
||||
@ -108,18 +108,19 @@
|
||||
/* ------------------------------------------------------------------------
|
||||
* ExecInitNode
|
||||
*
|
||||
* Recursively initializes all the nodes in the plan rooted
|
||||
* Recursively initializes all the nodes in the plan tree rooted
|
||||
* at 'node'.
|
||||
*
|
||||
* Initial States:
|
||||
* 'node' is the plan produced by the query planner
|
||||
* 'estate' is the shared execution state for the query tree
|
||||
* Inputs:
|
||||
* 'node' is the current node of the plan produced by the query planner
|
||||
* 'estate' is the shared execution state for the plan tree
|
||||
* 'eflags' is a bitwise OR of flag bits described in executor.h
|
||||
*
|
||||
* Returns a PlanState node corresponding to the given Plan node.
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
PlanState *
|
||||
ExecInitNode(Plan *node, EState *estate)
|
||||
ExecInitNode(Plan *node, EState *estate, int eflags)
|
||||
{
|
||||
PlanState *result;
|
||||
List *subps;
|
||||
@ -137,100 +138,122 @@ ExecInitNode(Plan *node, EState *estate)
|
||||
* control nodes
|
||||
*/
|
||||
case T_Result:
|
||||
result = (PlanState *) ExecInitResult((Result *) node, estate);
|
||||
result = (PlanState *) ExecInitResult((Result *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_Append:
|
||||
result = (PlanState *) ExecInitAppend((Append *) node, estate);
|
||||
result = (PlanState *) ExecInitAppend((Append *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_BitmapAnd:
|
||||
result = (PlanState *) ExecInitBitmapAnd((BitmapAnd *) node, estate);
|
||||
result = (PlanState *) ExecInitBitmapAnd((BitmapAnd *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_BitmapOr:
|
||||
result = (PlanState *) ExecInitBitmapOr((BitmapOr *) node, estate);
|
||||
result = (PlanState *) ExecInitBitmapOr((BitmapOr *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
/*
|
||||
* scan nodes
|
||||
*/
|
||||
case T_SeqScan:
|
||||
result = (PlanState *) ExecInitSeqScan((SeqScan *) node, estate);
|
||||
result = (PlanState *) ExecInitSeqScan((SeqScan *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_IndexScan:
|
||||
result = (PlanState *) ExecInitIndexScan((IndexScan *) node, estate);
|
||||
result = (PlanState *) ExecInitIndexScan((IndexScan *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_BitmapIndexScan:
|
||||
result = (PlanState *) ExecInitBitmapIndexScan((BitmapIndexScan *) node, estate);
|
||||
result = (PlanState *) ExecInitBitmapIndexScan((BitmapIndexScan *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_BitmapHeapScan:
|
||||
result = (PlanState *) ExecInitBitmapHeapScan((BitmapHeapScan *) node, estate);
|
||||
result = (PlanState *) ExecInitBitmapHeapScan((BitmapHeapScan *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_TidScan:
|
||||
result = (PlanState *) ExecInitTidScan((TidScan *) node, estate);
|
||||
result = (PlanState *) ExecInitTidScan((TidScan *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_SubqueryScan:
|
||||
result = (PlanState *) ExecInitSubqueryScan((SubqueryScan *) node, estate);
|
||||
result = (PlanState *) ExecInitSubqueryScan((SubqueryScan *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_FunctionScan:
|
||||
result = (PlanState *) ExecInitFunctionScan((FunctionScan *) node, estate);
|
||||
result = (PlanState *) ExecInitFunctionScan((FunctionScan *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
/*
|
||||
* join nodes
|
||||
*/
|
||||
case T_NestLoop:
|
||||
result = (PlanState *) ExecInitNestLoop((NestLoop *) node, estate);
|
||||
result = (PlanState *) ExecInitNestLoop((NestLoop *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_MergeJoin:
|
||||
result = (PlanState *) ExecInitMergeJoin((MergeJoin *) node, estate);
|
||||
result = (PlanState *) ExecInitMergeJoin((MergeJoin *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_HashJoin:
|
||||
result = (PlanState *) ExecInitHashJoin((HashJoin *) node, estate);
|
||||
result = (PlanState *) ExecInitHashJoin((HashJoin *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
/*
|
||||
* materialization nodes
|
||||
*/
|
||||
case T_Material:
|
||||
result = (PlanState *) ExecInitMaterial((Material *) node, estate);
|
||||
result = (PlanState *) ExecInitMaterial((Material *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_Sort:
|
||||
result = (PlanState *) ExecInitSort((Sort *) node, estate);
|
||||
result = (PlanState *) ExecInitSort((Sort *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_Group:
|
||||
result = (PlanState *) ExecInitGroup((Group *) node, estate);
|
||||
result = (PlanState *) ExecInitGroup((Group *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_Agg:
|
||||
result = (PlanState *) ExecInitAgg((Agg *) node, estate);
|
||||
result = (PlanState *) ExecInitAgg((Agg *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_Unique:
|
||||
result = (PlanState *) ExecInitUnique((Unique *) node, estate);
|
||||
result = (PlanState *) ExecInitUnique((Unique *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_Hash:
|
||||
result = (PlanState *) ExecInitHash((Hash *) node, estate);
|
||||
result = (PlanState *) ExecInitHash((Hash *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_SetOp:
|
||||
result = (PlanState *) ExecInitSetOp((SetOp *) node, estate);
|
||||
result = (PlanState *) ExecInitSetOp((SetOp *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
case T_Limit:
|
||||
result = (PlanState *) ExecInitLimit((Limit *) node, estate);
|
||||
result = (PlanState *) ExecInitLimit((Limit *) node,
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -251,7 +274,7 @@ ExecInitNode(Plan *node, EState *estate)
|
||||
|
||||
Assert(IsA(subplan, SubPlan));
|
||||
sstate = ExecInitExprInitPlan(subplan, result);
|
||||
ExecInitSubPlan(sstate, estate);
|
||||
ExecInitSubPlan(sstate, estate, eflags);
|
||||
subps = lappend(subps, sstate);
|
||||
}
|
||||
result->initPlan = subps;
|
||||
@ -267,7 +290,7 @@ ExecInitNode(Plan *node, EState *estate)
|
||||
SubPlanState *sstate = (SubPlanState *) lfirst(l);
|
||||
|
||||
Assert(IsA(sstate, SubPlanState));
|
||||
ExecInitSubPlan(sstate, estate);
|
||||
ExecInitSubPlan(sstate, estate, eflags);
|
||||
}
|
||||
|
||||
/* Set up instrumentation for this node if requested */
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.99 2005/11/22 18:17:10 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.100 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -330,7 +330,7 @@ postquel_start(execution_state *es, SQLFunctionCachePtr fcache)
|
||||
if (es->qd->operation != CMD_UTILITY)
|
||||
{
|
||||
AfterTriggerBeginQuery();
|
||||
ExecutorStart(es->qd, false);
|
||||
ExecutorStart(es->qd, 0);
|
||||
}
|
||||
|
||||
es->status = F_EXEC_RUN;
|
||||
|
@ -61,7 +61,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.136 2005/11/22 18:17:10 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.137 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1031,7 +1031,7 @@ agg_retrieve_hash_table(AggState *aggstate)
|
||||
* -----------------
|
||||
*/
|
||||
AggState *
|
||||
ExecInitAgg(Agg *node, EState *estate)
|
||||
ExecInitAgg(Agg *node, EState *estate, int eflags)
|
||||
{
|
||||
AggState *aggstate;
|
||||
AggStatePerAgg peragg;
|
||||
@ -1041,6 +1041,9 @@ ExecInitAgg(Agg *node, EState *estate)
|
||||
aggno;
|
||||
ListCell *l;
|
||||
|
||||
/* check for unsupported flags */
|
||||
Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
|
||||
|
||||
/*
|
||||
* create state structure
|
||||
*/
|
||||
@ -1107,9 +1110,14 @@ ExecInitAgg(Agg *node, EState *estate)
|
||||
|
||||
/*
|
||||
* initialize child nodes
|
||||
*
|
||||
* If we are doing a hashed aggregation then the child plan does not
|
||||
* need to handle REWIND efficiently; see ExecReScanAgg.
|
||||
*/
|
||||
if (node->aggstrategy == AGG_HASHED)
|
||||
eflags &= ~EXEC_FLAG_REWIND;
|
||||
outerPlan = outerPlan(node);
|
||||
outerPlanState(aggstate) = ExecInitNode(outerPlan, estate);
|
||||
outerPlanState(aggstate) = ExecInitNode(outerPlan, estate, eflags);
|
||||
|
||||
/*
|
||||
* initialize source tuple type.
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeAppend.c,v 1.66 2006/02/05 02:59:16 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeAppend.c,v 1.67 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -140,7 +140,7 @@ exec_append_initialize_next(AppendState *appendstate)
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
AppendState *
|
||||
ExecInitAppend(Append *node, EState *estate)
|
||||
ExecInitAppend(Append *node, EState *estate, int eflags)
|
||||
{
|
||||
AppendState *appendstate = makeNode(AppendState);
|
||||
PlanState **appendplanstates;
|
||||
@ -148,6 +148,9 @@ ExecInitAppend(Append *node, EState *estate)
|
||||
int i;
|
||||
Plan *initNode;
|
||||
|
||||
/* check for unsupported flags */
|
||||
Assert(!(eflags & EXEC_FLAG_MARK));
|
||||
|
||||
CXT1_printf("ExecInitAppend: context is %d\n", CurrentMemoryContext);
|
||||
|
||||
/*
|
||||
@ -213,7 +216,7 @@ ExecInitAppend(Append *node, EState *estate)
|
||||
exec_append_initialize_next(appendstate);
|
||||
|
||||
initNode = (Plan *) list_nth(node->appendplans, i);
|
||||
appendplanstates[i] = ExecInitNode(initNode, estate);
|
||||
appendplanstates[i] = ExecInitNode(initNode, estate, eflags);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapAnd.c,v 1.4 2005/10/15 02:49:17 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapAnd.c,v 1.5 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -40,7 +40,7 @@
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
BitmapAndState *
|
||||
ExecInitBitmapAnd(BitmapAnd *node, EState *estate)
|
||||
ExecInitBitmapAnd(BitmapAnd *node, EState *estate, int eflags)
|
||||
{
|
||||
BitmapAndState *bitmapandstate = makeNode(BitmapAndState);
|
||||
PlanState **bitmapplanstates;
|
||||
@ -49,6 +49,9 @@ ExecInitBitmapAnd(BitmapAnd *node, EState *estate)
|
||||
ListCell *l;
|
||||
Plan *initNode;
|
||||
|
||||
/* check for unsupported flags */
|
||||
Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
|
||||
|
||||
CXT1_printf("ExecInitBitmapAnd: context is %d\n", CurrentMemoryContext);
|
||||
|
||||
/*
|
||||
@ -83,7 +86,7 @@ ExecInitBitmapAnd(BitmapAnd *node, EState *estate)
|
||||
foreach(l, node->bitmapplans)
|
||||
{
|
||||
initNode = (Plan *) lfirst(l);
|
||||
bitmapplanstates[i] = ExecInitNode(initNode, estate);
|
||||
bitmapplanstates[i] = ExecInitNode(initNode, estate, eflags);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.8 2005/12/02 20:03:40 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.9 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -459,11 +459,14 @@ ExecEndBitmapHeapScan(BitmapHeapScanState *node)
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
BitmapHeapScanState *
|
||||
ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate)
|
||||
ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate, int eflags)
|
||||
{
|
||||
BitmapHeapScanState *scanstate;
|
||||
Relation currentRelation;
|
||||
|
||||
/* check for unsupported flags */
|
||||
Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
|
||||
|
||||
/*
|
||||
* Assert caller didn't ask for an unsafe snapshot --- see comments
|
||||
* at head of file.
|
||||
@ -552,7 +555,7 @@ ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate)
|
||||
* relation's indexes, and we want to be sure we have acquired a lock
|
||||
* on the relation first.
|
||||
*/
|
||||
outerPlanState(scanstate) = ExecInitNode(outerPlan(node), estate);
|
||||
outerPlanState(scanstate) = ExecInitNode(outerPlan(node), estate, eflags);
|
||||
|
||||
/*
|
||||
* all done.
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.15 2006/01/25 20:29:23 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.16 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -211,11 +211,14 @@ ExecEndBitmapIndexScan(BitmapIndexScanState *node)
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
BitmapIndexScanState *
|
||||
ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate)
|
||||
ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags)
|
||||
{
|
||||
BitmapIndexScanState *indexstate;
|
||||
bool relistarget;
|
||||
|
||||
/* check for unsupported flags */
|
||||
Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
|
||||
|
||||
/*
|
||||
* create state structure
|
||||
*/
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapOr.c,v 1.3 2005/10/15 02:49:17 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapOr.c,v 1.4 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -41,7 +41,7 @@
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
BitmapOrState *
|
||||
ExecInitBitmapOr(BitmapOr *node, EState *estate)
|
||||
ExecInitBitmapOr(BitmapOr *node, EState *estate, int eflags)
|
||||
{
|
||||
BitmapOrState *bitmaporstate = makeNode(BitmapOrState);
|
||||
PlanState **bitmapplanstates;
|
||||
@ -50,6 +50,9 @@ ExecInitBitmapOr(BitmapOr *node, EState *estate)
|
||||
ListCell *l;
|
||||
Plan *initNode;
|
||||
|
||||
/* check for unsupported flags */
|
||||
Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
|
||||
|
||||
CXT1_printf("ExecInitBitmapOr: context is %d\n", CurrentMemoryContext);
|
||||
|
||||
/*
|
||||
@ -84,7 +87,7 @@ ExecInitBitmapOr(BitmapOr *node, EState *estate)
|
||||
foreach(l, node->bitmapplans)
|
||||
{
|
||||
initNode = (Plan *) lfirst(l);
|
||||
bitmapplanstates[i] = ExecInitNode(initNode, estate);
|
||||
bitmapplanstates[i] = ExecInitNode(initNode, estate, eflags);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeFunctionscan.c,v 1.35 2005/10/15 02:49:17 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeFunctionscan.c,v 1.36 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -120,7 +120,7 @@ ExecFunctionScan(FunctionScanState *node)
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
FunctionScanState *
|
||||
ExecInitFunctionScan(FunctionScan *node, EState *estate)
|
||||
ExecInitFunctionScan(FunctionScan *node, EState *estate, int eflags)
|
||||
{
|
||||
FunctionScanState *scanstate;
|
||||
RangeTblEntry *rte;
|
||||
|
@ -15,7 +15,7 @@
|
||||
* locate group boundaries.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeGroup.c,v 1.62 2005/10/15 02:49:17 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeGroup.c,v 1.63 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -154,10 +154,13 @@ ExecGroup(GroupState *node)
|
||||
* -----------------
|
||||
*/
|
||||
GroupState *
|
||||
ExecInitGroup(Group *node, EState *estate)
|
||||
ExecInitGroup(Group *node, EState *estate, int eflags)
|
||||
{
|
||||
GroupState *grpstate;
|
||||
|
||||
/* check for unsupported flags */
|
||||
Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
|
||||
|
||||
/*
|
||||
* create state structure
|
||||
*/
|
||||
@ -192,7 +195,7 @@ ExecInitGroup(Group *node, EState *estate)
|
||||
/*
|
||||
* initialize child nodes
|
||||
*/
|
||||
outerPlanState(grpstate) = ExecInitNode(outerPlan(node), estate);
|
||||
outerPlanState(grpstate) = ExecInitNode(outerPlan(node), estate, eflags);
|
||||
|
||||
/*
|
||||
* initialize tuple type.
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.99 2005/11/23 20:27:57 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.100 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -116,10 +116,13 @@ MultiExecHash(HashState *node)
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
HashState *
|
||||
ExecInitHash(Hash *node, EState *estate)
|
||||
ExecInitHash(Hash *node, EState *estate, int eflags)
|
||||
{
|
||||
HashState *hashstate;
|
||||
|
||||
/* check for unsupported flags */
|
||||
Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
|
||||
|
||||
SO_printf("ExecInitHash: initializing hash node\n");
|
||||
|
||||
/*
|
||||
@ -158,7 +161,7 @@ ExecInitHash(Hash *node, EState *estate)
|
||||
/*
|
||||
* initialize child nodes
|
||||
*/
|
||||
outerPlanState(hashstate) = ExecInitNode(outerPlan(node), estate);
|
||||
outerPlanState(hashstate) = ExecInitNode(outerPlan(node), estate, eflags);
|
||||
|
||||
/*
|
||||
* initialize tuple type. no need to initialize projection info because
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.79 2005/11/28 23:46:03 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.80 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -335,7 +335,7 @@ ExecHashJoin(HashJoinState *node)
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
HashJoinState *
|
||||
ExecInitHashJoin(HashJoin *node, EState *estate)
|
||||
ExecInitHashJoin(HashJoin *node, EState *estate, int eflags)
|
||||
{
|
||||
HashJoinState *hjstate;
|
||||
Plan *outerNode;
|
||||
@ -345,6 +345,9 @@ ExecInitHashJoin(HashJoin *node, EState *estate)
|
||||
List *hoperators;
|
||||
ListCell *l;
|
||||
|
||||
/* check for unsupported flags */
|
||||
Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
|
||||
|
||||
/*
|
||||
* create state structure
|
||||
*/
|
||||
@ -378,12 +381,16 @@ ExecInitHashJoin(HashJoin *node, EState *estate)
|
||||
|
||||
/*
|
||||
* initialize child nodes
|
||||
*
|
||||
* Note: we could suppress the REWIND flag for the inner input, which
|
||||
* would amount to betting that the hash will be a single batch. Not
|
||||
* clear if this would be a win or not.
|
||||
*/
|
||||
outerNode = outerPlan(node);
|
||||
hashNode = (Hash *) innerPlan(node);
|
||||
|
||||
outerPlanState(hjstate) = ExecInitNode(outerNode, estate);
|
||||
innerPlanState(hjstate) = ExecInitNode((Plan *) hashNode, estate);
|
||||
outerPlanState(hjstate) = ExecInitNode(outerNode, estate, eflags);
|
||||
innerPlanState(hjstate) = ExecInitNode((Plan *) hashNode, estate, eflags);
|
||||
|
||||
#define HASHJOIN_NSLOTS 3
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.110 2006/01/25 20:29:23 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.111 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -458,7 +458,7 @@ ExecIndexRestrPos(IndexScanState *node)
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
IndexScanState *
|
||||
ExecInitIndexScan(IndexScan *node, EState *estate)
|
||||
ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
|
||||
{
|
||||
IndexScanState *indexstate;
|
||||
Relation currentRelation;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeLimit.c,v 1.23 2005/11/23 20:27:57 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeLimit.c,v 1.24 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -280,11 +280,14 @@ recompute_limits(LimitState *node)
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
LimitState *
|
||||
ExecInitLimit(Limit *node, EState *estate)
|
||||
ExecInitLimit(Limit *node, EState *estate, int eflags)
|
||||
{
|
||||
LimitState *limitstate;
|
||||
Plan *outerPlan;
|
||||
|
||||
/* check for unsupported flags */
|
||||
Assert(!(eflags & EXEC_FLAG_MARK));
|
||||
|
||||
/*
|
||||
* create state structure
|
||||
*/
|
||||
@ -321,7 +324,7 @@ ExecInitLimit(Limit *node, EState *estate)
|
||||
* then initialize outer plan
|
||||
*/
|
||||
outerPlan = outerPlan(node);
|
||||
outerPlanState(limitstate) = ExecInitNode(outerPlan, estate);
|
||||
outerPlanState(limitstate) = ExecInitNode(outerPlan, estate, eflags);
|
||||
|
||||
/*
|
||||
* limit nodes do no projections, so initialize projection info for this
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeMaterial.c,v 1.51 2005/11/23 20:27:57 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeMaterial.c,v 1.52 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -153,7 +153,7 @@ ExecMaterial(MaterialState *node)
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
MaterialState *
|
||||
ExecInitMaterial(Material *node, EState *estate)
|
||||
ExecInitMaterial(Material *node, EState *estate, int eflags)
|
||||
{
|
||||
MaterialState *matstate;
|
||||
Plan *outerPlan;
|
||||
@ -186,10 +186,15 @@ ExecInitMaterial(Material *node, EState *estate)
|
||||
ExecInitScanTupleSlot(estate, &matstate->ss);
|
||||
|
||||
/*
|
||||
* initializes child nodes
|
||||
* initialize child nodes
|
||||
*
|
||||
* We shield the child node from the need to support REWIND, BACKWARD,
|
||||
* or MARK/RESTORE.
|
||||
*/
|
||||
eflags &= ~(EXEC_FLAG_REWIND | EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK);
|
||||
|
||||
outerPlan = outerPlan(node);
|
||||
outerPlanState(matstate) = ExecInitNode(outerPlan, estate);
|
||||
outerPlanState(matstate) = ExecInitNode(outerPlan, estate, eflags);
|
||||
|
||||
/*
|
||||
* initialize tuple type. no need to initialize projection info because
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeMergejoin.c,v 1.76 2005/11/22 18:17:10 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeMergejoin.c,v 1.77 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1466,10 +1466,13 @@ ExecMergeJoin(MergeJoinState *node)
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
MergeJoinState *
|
||||
ExecInitMergeJoin(MergeJoin *node, EState *estate)
|
||||
ExecInitMergeJoin(MergeJoin *node, EState *estate, int eflags)
|
||||
{
|
||||
MergeJoinState *mergestate;
|
||||
|
||||
/* check for unsupported flags */
|
||||
Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
|
||||
|
||||
MJ1_printf("ExecInitMergeJoin: %s\n",
|
||||
"initializing node");
|
||||
|
||||
@ -1512,9 +1515,12 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate)
|
||||
|
||||
/*
|
||||
* initialize child nodes
|
||||
*
|
||||
* inner child must support MARK/RESTORE.
|
||||
*/
|
||||
outerPlanState(mergestate) = ExecInitNode(outerPlan(node), estate);
|
||||
innerPlanState(mergestate) = ExecInitNode(innerPlan(node), estate);
|
||||
outerPlanState(mergestate) = ExecInitNode(outerPlan(node), estate, eflags);
|
||||
innerPlanState(mergestate) = ExecInitNode(innerPlan(node), estate,
|
||||
eflags | EXEC_FLAG_MARK);
|
||||
|
||||
#define MERGEJOIN_NSLOTS 4
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeNestloop.c,v 1.40 2005/11/22 18:17:10 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeNestloop.c,v 1.41 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -272,10 +272,13 @@ ExecNestLoop(NestLoopState *node)
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
NestLoopState *
|
||||
ExecInitNestLoop(NestLoop *node, EState *estate)
|
||||
ExecInitNestLoop(NestLoop *node, EState *estate, int eflags)
|
||||
{
|
||||
NestLoopState *nlstate;
|
||||
|
||||
/* check for unsupported flags */
|
||||
Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
|
||||
|
||||
NL1_printf("ExecInitNestLoop: %s\n",
|
||||
"initializing node");
|
||||
|
||||
@ -309,9 +312,16 @@ ExecInitNestLoop(NestLoop *node, EState *estate)
|
||||
|
||||
/*
|
||||
* initialize child nodes
|
||||
*
|
||||
* Tell the inner child that cheap rescans would be good. (This is
|
||||
* unnecessary if we are doing nestloop with inner indexscan, because
|
||||
* the rescan will always be with a fresh parameter --- but since
|
||||
* nodeIndexscan doesn't actually care about REWIND, there's no point
|
||||
* in dealing with that refinement.)
|
||||
*/
|
||||
outerPlanState(nlstate) = ExecInitNode(outerPlan(node), estate);
|
||||
innerPlanState(nlstate) = ExecInitNode(innerPlan(node), estate);
|
||||
outerPlanState(nlstate) = ExecInitNode(outerPlan(node), estate, eflags);
|
||||
innerPlanState(nlstate) = ExecInitNode(innerPlan(node), estate,
|
||||
eflags | EXEC_FLAG_REWIND);
|
||||
|
||||
#define NESTLOOP_NSLOTS 2
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeResult.c,v 1.32 2005/10/15 02:49:17 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeResult.c,v 1.33 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -170,15 +170,19 @@ ExecResult(ResultState *node)
|
||||
* ExecInitResult
|
||||
*
|
||||
* Creates the run-time state information for the result node
|
||||
* produced by the planner and initailizes outer relations
|
||||
* produced by the planner and initializes outer relations
|
||||
* (child nodes).
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
ResultState *
|
||||
ExecInitResult(Result *node, EState *estate)
|
||||
ExecInitResult(Result *node, EState *estate, int eflags)
|
||||
{
|
||||
ResultState *resstate;
|
||||
|
||||
/* check for unsupported flags */
|
||||
Assert(!(eflags & EXEC_FLAG_MARK));
|
||||
Assert(!(eflags & EXEC_FLAG_BACKWARD) || outerPlan(node) != NULL);
|
||||
|
||||
/*
|
||||
* create state structure
|
||||
*/
|
||||
@ -218,7 +222,7 @@ ExecInitResult(Result *node, EState *estate)
|
||||
/*
|
||||
* initialize child nodes
|
||||
*/
|
||||
outerPlanState(resstate) = ExecInitNode(outerPlan(node), estate);
|
||||
outerPlanState(resstate) = ExecInitNode(outerPlan(node), estate, eflags);
|
||||
|
||||
/*
|
||||
* we don't use inner plan
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSeqscan.c,v 1.56 2005/12/02 20:03:40 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSeqscan.c,v 1.57 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -168,7 +168,7 @@ InitScanRelation(SeqScanState *node, EState *estate)
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
SeqScanState *
|
||||
ExecInitSeqScan(SeqScan *node, EState *estate)
|
||||
ExecInitSeqScan(SeqScan *node, EState *estate, int eflags)
|
||||
{
|
||||
SeqScanState *scanstate;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSetOp.c,v 1.19 2005/11/23 20:27:57 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSetOp.c,v 1.20 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -213,10 +213,13 @@ ExecSetOp(SetOpState *node)
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
SetOpState *
|
||||
ExecInitSetOp(SetOp *node, EState *estate)
|
||||
ExecInitSetOp(SetOp *node, EState *estate, int eflags)
|
||||
{
|
||||
SetOpState *setopstate;
|
||||
|
||||
/* check for unsupported flags */
|
||||
Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
|
||||
|
||||
/*
|
||||
* create state structure
|
||||
*/
|
||||
@ -252,7 +255,7 @@ ExecInitSetOp(SetOp *node, EState *estate)
|
||||
/*
|
||||
* then initialize outer plan
|
||||
*/
|
||||
outerPlanState(setopstate) = ExecInitNode(outerPlan(node), estate);
|
||||
outerPlanState(setopstate) = ExecInitNode(outerPlan(node), estate, eflags);
|
||||
|
||||
/*
|
||||
* setop nodes do no projections, so initialize projection info for this
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSort.c,v 1.53 2006/02/26 22:58:12 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSort.c,v 1.54 2006/02/28 04:10:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -146,11 +146,11 @@ ExecSort(SortState *node)
|
||||
* ExecInitSort
|
||||
*
|
||||
* Creates the run-time state information for the sort node
|
||||
* produced by the planner and initailizes its outer subtree.
|
||||
* produced by the planner and initializes its outer subtree.
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
SortState *
|
||||
ExecInitSort(Sort *node, EState *estate)
|
||||
ExecInitSort(Sort *node, EState *estate, int eflags)
|
||||
{
|
||||
SortState *sortstate;
|
||||
|
||||
@ -185,9 +185,14 @@ ExecInitSort(Sort *node, EState *estate)
|
||||
ExecInitScanTupleSlot(estate, &sortstate->ss);
|
||||
|
||||
/*
|
||||
* initializes child nodes
|
||||
* initialize child nodes
|
||||
*
|
||||
* We shield the child node from the need to support REWIND, BACKWARD,
|
||||
* or MARK/RESTORE.
|
||||
*/
|
||||
outerPlanState(sortstate) = ExecInitNode(outerPlan(node), estate);
|
||||
eflags &= ~(EXEC_FLAG_REWIND | EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK);
|
||||
|
||||
outerPlanState(sortstate) = ExecInitNode(outerPlan(node), estate, eflags);
|
||||
|
||||
/*
|
||||
* initialize tuple type. no need to initialize projection info because
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSubplan.c,v 1.72 2005/12/28 01:29:59 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSubplan.c,v 1.73 2006/02/28 04:10:28 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -625,10 +625,14 @@ slotNoNulls(TupleTableSlot *slot)
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* ExecInitSubPlan
|
||||
*
|
||||
* Note: the eflags are those passed to the parent plan node of this
|
||||
* subplan; they don't directly describe the execution conditions the
|
||||
* subplan will face.
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
ExecInitSubPlan(SubPlanState *node, EState *estate)
|
||||
ExecInitSubPlan(SubPlanState *node, EState *estate, int eflags)
|
||||
{
|
||||
SubPlan *subplan = (SubPlan *) node->xprstate.expr;
|
||||
EState *sp_estate;
|
||||
@ -678,8 +682,16 @@ ExecInitSubPlan(SubPlanState *node, EState *estate)
|
||||
|
||||
/*
|
||||
* Start up the subplan (this is a very cut-down form of InitPlan())
|
||||
*
|
||||
* The subplan will never need to do BACKWARD scan or MARK/RESTORE.
|
||||
* If it is a parameterless subplan (not initplan), we suggest that it
|
||||
* be prepared to handle REWIND efficiently; otherwise there is no need.
|
||||
*/
|
||||
node->planstate = ExecInitNode(subplan->plan, sp_estate);
|
||||
eflags &= EXEC_FLAG_EXPLAIN_ONLY;
|
||||
if (subplan->parParam == NIL && subplan->setParam == NIL)
|
||||
eflags |= EXEC_FLAG_REWIND;
|
||||
|
||||
node->planstate = ExecInitNode(subplan->plan, sp_estate, eflags);
|
||||
|
||||
node->needShutdown = true; /* now we need to shutdown the subplan */
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.27 2005/10/15 02:49:17 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.28 2006/02/28 04:10:28 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -111,13 +111,16 @@ ExecSubqueryScan(SubqueryScanState *node)
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
SubqueryScanState *
|
||||
ExecInitSubqueryScan(SubqueryScan *node, EState *estate)
|
||||
ExecInitSubqueryScan(SubqueryScan *node, EState *estate, int eflags)
|
||||
{
|
||||
SubqueryScanState *subquerystate;
|
||||
RangeTblEntry *rte;
|
||||
EState *sp_estate;
|
||||
MemoryContext oldcontext;
|
||||
|
||||
/* check for unsupported flags */
|
||||
Assert(!(eflags & EXEC_FLAG_MARK));
|
||||
|
||||
/*
|
||||
* SubqueryScan should not have any "normal" children.
|
||||
*/
|
||||
@ -192,7 +195,7 @@ ExecInitSubqueryScan(SubqueryScan *node, EState *estate)
|
||||
/*
|
||||
* Start up the subplan (this is a very cut-down form of InitPlan())
|
||||
*/
|
||||
subquerystate->subplan = ExecInitNode(node->subplan, sp_estate);
|
||||
subquerystate->subplan = ExecInitNode(node->subplan, sp_estate, eflags);
|
||||
|
||||
MemoryContextSwitchTo(oldcontext);
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeTidscan.c,v 1.46 2005/12/02 20:03:41 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeTidscan.c,v 1.47 2006/02/28 04:10:28 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -465,7 +465,7 @@ ExecTidRestrPos(TidScanState *node)
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
TidScanState *
|
||||
ExecInitTidScan(TidScan *node, EState *estate)
|
||||
ExecInitTidScan(TidScan *node, EState *estate, int eflags)
|
||||
{
|
||||
TidScanState *tidstate;
|
||||
Relation currentRelation;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeUnique.c,v 1.50 2005/11/23 20:27:57 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeUnique.c,v 1.51 2006/02/28 04:10:28 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -109,10 +109,13 @@ ExecUnique(UniqueState *node)
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
UniqueState *
|
||||
ExecInitUnique(Unique *node, EState *estate)
|
||||
ExecInitUnique(Unique *node, EState *estate, int eflags)
|
||||
{
|
||||
UniqueState *uniquestate;
|
||||
|
||||
/* check for unsupported flags */
|
||||
Assert(!(eflags & EXEC_FLAG_MARK));
|
||||
|
||||
/*
|
||||
* create state structure
|
||||
*/
|
||||
@ -144,7 +147,7 @@ ExecInitUnique(Unique *node, EState *estate)
|
||||
/*
|
||||
* then initialize outer plan
|
||||
*/
|
||||
outerPlanState(uniquestate) = ExecInitNode(outerPlan(node), estate);
|
||||
outerPlanState(uniquestate) = ExecInitNode(outerPlan(node), estate, eflags);
|
||||
|
||||
/*
|
||||
* unique nodes do no projections, so initialize projection info for this
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.146 2006/01/18 06:49:27 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.147 2006/02/28 04:10:28 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1553,7 +1553,7 @@ _SPI_pquery(QueryDesc *queryDesc, long tcount)
|
||||
|
||||
AfterTriggerBeginQuery();
|
||||
|
||||
ExecutorStart(queryDesc, false);
|
||||
ExecutorStart(queryDesc, 0);
|
||||
|
||||
ExecutorRun(queryDesc, ForwardScanDirection, tcount);
|
||||
|
||||
|
Reference in New Issue
Block a user