From 2c0ef9777cce8f97dd01073d962e6aa31722b5ad Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 28 Feb 2006 04:10:28 +0000 Subject: [PATCH] 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 --- src/backend/commands/explain.c | 11 ++- src/backend/executor/execMain.c | 23 +++--- src/backend/executor/execProcnode.c | 85 ++++++++++++++-------- src/backend/executor/functions.c | 4 +- src/backend/executor/nodeAgg.c | 14 +++- src/backend/executor/nodeAppend.c | 9 ++- src/backend/executor/nodeBitmapAnd.c | 9 ++- src/backend/executor/nodeBitmapHeapscan.c | 9 ++- src/backend/executor/nodeBitmapIndexscan.c | 7 +- src/backend/executor/nodeBitmapOr.c | 9 ++- src/backend/executor/nodeFunctionscan.c | 4 +- src/backend/executor/nodeGroup.c | 9 ++- src/backend/executor/nodeHash.c | 9 ++- src/backend/executor/nodeHashjoin.c | 15 +++- src/backend/executor/nodeIndexscan.c | 4 +- src/backend/executor/nodeLimit.c | 9 ++- src/backend/executor/nodeMaterial.c | 13 +++- src/backend/executor/nodeMergejoin.c | 14 +++- src/backend/executor/nodeNestloop.c | 18 ++++- src/backend/executor/nodeResult.c | 12 ++- src/backend/executor/nodeSeqscan.c | 4 +- src/backend/executor/nodeSetOp.c | 9 ++- src/backend/executor/nodeSort.c | 15 ++-- src/backend/executor/nodeSubplan.c | 18 ++++- src/backend/executor/nodeSubqueryscan.c | 9 ++- src/backend/executor/nodeTidscan.c | 4 +- src/backend/executor/nodeUnique.c | 9 ++- src/backend/executor/spi.c | 4 +- src/backend/tcop/pquery.c | 20 +++-- src/include/executor/executor.h | 39 +++++++++- src/include/executor/nodeAgg.h | 4 +- src/include/executor/nodeAppend.h | 4 +- src/include/executor/nodeBitmapAnd.h | 4 +- src/include/executor/nodeBitmapHeapscan.h | 4 +- src/include/executor/nodeBitmapIndexscan.h | 4 +- src/include/executor/nodeBitmapOr.h | 4 +- src/include/executor/nodeFunctionscan.h | 4 +- src/include/executor/nodeGroup.h | 4 +- src/include/executor/nodeHash.h | 4 +- src/include/executor/nodeHashjoin.h | 4 +- src/include/executor/nodeIndexscan.h | 4 +- src/include/executor/nodeLimit.h | 4 +- src/include/executor/nodeMaterial.h | 4 +- src/include/executor/nodeMergejoin.h | 4 +- src/include/executor/nodeNestloop.h | 4 +- src/include/executor/nodeResult.h | 4 +- src/include/executor/nodeSeqscan.h | 4 +- src/include/executor/nodeSetOp.h | 4 +- src/include/executor/nodeSort.h | 4 +- src/include/executor/nodeSubplan.h | 4 +- src/include/executor/nodeSubqueryscan.h | 4 +- src/include/executor/nodeTidscan.h | 4 +- src/include/executor/nodeUnique.h | 4 +- 53 files changed, 336 insertions(+), 174 deletions(-) diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 5cfc15c339..755a64a944 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994-5, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.143 2006/02/05 02:59:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.144 2006/02/28 04:10:27 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -233,6 +233,7 @@ ExplainOnePlan(QueryDesc *queryDesc, ExplainStmt *stmt, double totaltime = 0; ExplainState *es; StringInfo str; + int eflags; INSTR_TIME_SET_CURRENT(starttime); @@ -240,8 +241,14 @@ ExplainOnePlan(QueryDesc *queryDesc, ExplainStmt *stmt, if (stmt->analyze) AfterTriggerBeginQuery(); + /* Select execution options */ + if (stmt->analyze) + eflags = 0; /* default run-to-completion flags */ + else + eflags = EXEC_FLAG_EXPLAIN_ONLY; + /* call ExecutorStart to prepare the plan for execution */ - ExecutorStart(queryDesc, !stmt->analyze); + ExecutorStart(queryDesc, eflags); /* Execute the plan for statistics if asked for */ if (stmt->analyze) diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 57570a5cc0..48449e3955 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -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); } diff --git a/src/backend/executor/execProcnode.c b/src/backend/executor/execProcnode.c index c8b8d41951..d7d3e541fa 100644 --- a/src/backend/executor/execProcnode.c +++ b/src/backend/executor/execProcnode.c @@ -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 */ diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c index 35f66b878a..0196b64e19 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -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; diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index 6832cdfbee..83ea3e4384 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -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. diff --git a/src/backend/executor/nodeAppend.c b/src/backend/executor/nodeAppend.c index 0b5e81096d..c2ea48d682 100644 --- a/src/backend/executor/nodeAppend.c +++ b/src/backend/executor/nodeAppend.c @@ -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); } /* diff --git a/src/backend/executor/nodeBitmapAnd.c b/src/backend/executor/nodeBitmapAnd.c index a9e63cbfcc..8218ecfb9d 100644 --- a/src/backend/executor/nodeBitmapAnd.c +++ b/src/backend/executor/nodeBitmapAnd.c @@ -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++; } diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c index 959b559d1b..df276b87b1 100644 --- a/src/backend/executor/nodeBitmapHeapscan.c +++ b/src/backend/executor/nodeBitmapHeapscan.c @@ -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. diff --git a/src/backend/executor/nodeBitmapIndexscan.c b/src/backend/executor/nodeBitmapIndexscan.c index 37839c0255..327c852644 100644 --- a/src/backend/executor/nodeBitmapIndexscan.c +++ b/src/backend/executor/nodeBitmapIndexscan.c @@ -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 */ diff --git a/src/backend/executor/nodeBitmapOr.c b/src/backend/executor/nodeBitmapOr.c index 772b948cc5..94512393d8 100644 --- a/src/backend/executor/nodeBitmapOr.c +++ b/src/backend/executor/nodeBitmapOr.c @@ -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++; } diff --git a/src/backend/executor/nodeFunctionscan.c b/src/backend/executor/nodeFunctionscan.c index a0178e8fa1..547e5ba801 100644 --- a/src/backend/executor/nodeFunctionscan.c +++ b/src/backend/executor/nodeFunctionscan.c @@ -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; diff --git a/src/backend/executor/nodeGroup.c b/src/backend/executor/nodeGroup.c index 91a08add4d..3bc3948315 100644 --- a/src/backend/executor/nodeGroup.c +++ b/src/backend/executor/nodeGroup.c @@ -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. diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c index 82f05855e6..a4dc6026c1 100644 --- a/src/backend/executor/nodeHash.c +++ b/src/backend/executor/nodeHash.c @@ -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 diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c index 7363ab2a2c..a21184a3a8 100644 --- a/src/backend/executor/nodeHashjoin.c +++ b/src/backend/executor/nodeHashjoin.c @@ -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 diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c index 16406c784f..b5f3d11214 100644 --- a/src/backend/executor/nodeIndexscan.c +++ b/src/backend/executor/nodeIndexscan.c @@ -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; diff --git a/src/backend/executor/nodeLimit.c b/src/backend/executor/nodeLimit.c index f9397dc475..237dcc565c 100644 --- a/src/backend/executor/nodeLimit.c +++ b/src/backend/executor/nodeLimit.c @@ -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 diff --git a/src/backend/executor/nodeMaterial.c b/src/backend/executor/nodeMaterial.c index 558797c380..641fe3afc2 100644 --- a/src/backend/executor/nodeMaterial.c +++ b/src/backend/executor/nodeMaterial.c @@ -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 diff --git a/src/backend/executor/nodeMergejoin.c b/src/backend/executor/nodeMergejoin.c index 43a464f1bf..6aeab2122a 100644 --- a/src/backend/executor/nodeMergejoin.c +++ b/src/backend/executor/nodeMergejoin.c @@ -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 diff --git a/src/backend/executor/nodeNestloop.c b/src/backend/executor/nodeNestloop.c index e205b218bd..4611a809af 100644 --- a/src/backend/executor/nodeNestloop.c +++ b/src/backend/executor/nodeNestloop.c @@ -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 diff --git a/src/backend/executor/nodeResult.c b/src/backend/executor/nodeResult.c index 013c4e9979..e821b63a10 100644 --- a/src/backend/executor/nodeResult.c +++ b/src/backend/executor/nodeResult.c @@ -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 diff --git a/src/backend/executor/nodeSeqscan.c b/src/backend/executor/nodeSeqscan.c index 5e8ba95ee2..6fbf9c7ad2 100644 --- a/src/backend/executor/nodeSeqscan.c +++ b/src/backend/executor/nodeSeqscan.c @@ -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; diff --git a/src/backend/executor/nodeSetOp.c b/src/backend/executor/nodeSetOp.c index 2a7d254287..105b615bcf 100644 --- a/src/backend/executor/nodeSetOp.c +++ b/src/backend/executor/nodeSetOp.c @@ -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 diff --git a/src/backend/executor/nodeSort.c b/src/backend/executor/nodeSort.c index 255ffcff25..367adbfbe2 100644 --- a/src/backend/executor/nodeSort.c +++ b/src/backend/executor/nodeSort.c @@ -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 diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c index 80679d9f63..fd74cdc618 100644 --- a/src/backend/executor/nodeSubplan.c +++ b/src/backend/executor/nodeSubplan.c @@ -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 */ diff --git a/src/backend/executor/nodeSubqueryscan.c b/src/backend/executor/nodeSubqueryscan.c index 9b1bd25143..b9b93ec147 100644 --- a/src/backend/executor/nodeSubqueryscan.c +++ b/src/backend/executor/nodeSubqueryscan.c @@ -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); diff --git a/src/backend/executor/nodeTidscan.c b/src/backend/executor/nodeTidscan.c index e6d61c78a6..193cebbc84 100644 --- a/src/backend/executor/nodeTidscan.c +++ b/src/backend/executor/nodeTidscan.c @@ -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; diff --git a/src/backend/executor/nodeUnique.c b/src/backend/executor/nodeUnique.c index 0c033502c3..0881a9159e 100644 --- a/src/backend/executor/nodeUnique.c +++ b/src/backend/executor/nodeUnique.c @@ -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 diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index 278860600b..e4a2c952d1 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -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); diff --git a/src/backend/tcop/pquery.c b/src/backend/tcop/pquery.c index 001be06521..37ee0d4f20 100644 --- a/src/backend/tcop/pquery.c +++ b/src/backend/tcop/pquery.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.99 2006/02/21 23:01:54 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.100 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -164,9 +164,9 @@ ProcessQuery(Query *parsetree, AfterTriggerBeginQuery(); /* - * Call ExecStart to prepare the plan for execution + * Call ExecutorStart to prepare the plan for execution */ - ExecutorStart(queryDesc, false); + ExecutorStart(queryDesc, 0); /* * Run the plan to completion. @@ -329,6 +329,7 @@ PortalStart(Portal portal, ParamListInfo params, Snapshot snapshot) MemoryContext savePortalContext; MemoryContext oldContext; QueryDesc *queryDesc; + int eflags; AssertArg(PortalIsValid(portal)); AssertState(portal->queryContext != NULL); /* query defined? */ @@ -394,9 +395,18 @@ PortalStart(Portal portal, ParamListInfo params, Snapshot snapshot) */ /* - * Call ExecStart to prepare the plan for execution + * If it's a scrollable cursor, executor needs to support + * REWIND and backwards scan. */ - ExecutorStart(queryDesc, false); + if (portal->cursorOptions & CURSOR_OPT_SCROLL) + eflags = EXEC_FLAG_REWIND | EXEC_FLAG_BACKWARD; + else + eflags = 0; /* default run-to-completion flags */ + + /* + * Call ExecutorStart to prepare the plan for execution + */ + ExecutorStart(queryDesc, eflags); /* * This tells PortalCleanup to shut down the executor diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index e320a8bf92..725eed3a8c 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.124 2006/01/12 21:48:53 tgl Exp $ + * $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.125 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,6 +17,39 @@ #include "executor/execdesc.h" +/* + * The "eflags" argument to ExecutorStart and the various ExecInitNode + * routines is a bitwise OR of the following flag bits, which tell the + * called plan node what to expect. Note that the flags will get modified + * as they are passed down the plan tree, since an upper node may require + * functionality in its subnode not demanded of the plan as a whole + * (example: MergeJoin requires mark/restore capability in its inner input), + * or an upper node may shield its input from some functionality requirement + * (example: Materialize shields its input from needing to do backward scan). + * + * EXPLAIN_ONLY indicates that the plan tree is being initialized just so + * EXPLAIN can print it out; it will not be run. Hence, no side-effects + * of startup should occur (such as creating a SELECT INTO target table). + * However, error checks (such as permission checks) should be performed. + * + * REWIND indicates that the plan node should try to efficiently support + * rescans without parameter changes. (Nodes must support ExecReScan calls + * in any case, but if this flag was not given, they are at liberty to do it + * through complete recalculation. Note that a parameter change forces a + * full recalculation in any case.) + * + * BACKWARD indicates that the plan node must respect the es_direction flag. + * When this is not passed, the plan node will only be run forwards. + * + * MARK indicates that the plan node must support Mark/Restore calls. + * When this is not passed, no Mark/Restore will occur. + */ +#define EXEC_FLAG_EXPLAIN_ONLY 0x0001 /* EXPLAIN, no ANALYZE */ +#define EXEC_FLAG_REWIND 0x0002 /* need efficient rescan */ +#define EXEC_FLAG_BACKWARD 0x0004 /* need backward scan */ +#define EXEC_FLAG_MARK 0x0008 /* need mark/restore */ + + /* * ExecEvalExpr was formerly a function containing a switch statement; * now it's just a macro invoking the function pointed to by an ExprState @@ -87,7 +120,7 @@ extern HeapTuple ExecRemoveJunk(JunkFilter *junkfilter, TupleTableSlot *slot); /* * prototypes from functions in execMain.c */ -extern void ExecutorStart(QueryDesc *queryDesc, bool explainOnly); +extern void ExecutorStart(QueryDesc *queryDesc, int eflags); extern TupleTableSlot *ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, long count); extern void ExecutorEnd(QueryDesc *queryDesc); @@ -103,7 +136,7 @@ extern TupleTableSlot *EvalPlanQual(EState *estate, Index rti, /* * prototypes from functions in execProcnode.c */ -extern PlanState *ExecInitNode(Plan *node, EState *estate); +extern PlanState *ExecInitNode(Plan *node, EState *estate, int eflags); extern TupleTableSlot *ExecProcNode(PlanState *node); extern Node *MultiExecProcNode(PlanState *node); extern int ExecCountSlotsNode(Plan *node); diff --git a/src/include/executor/nodeAgg.h b/src/include/executor/nodeAgg.h index 41dd57a8ac..4899f7d53e 100644 --- a/src/include/executor/nodeAgg.h +++ b/src/include/executor/nodeAgg.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeAgg.h,v 1.24 2005/01/28 19:34:18 tgl Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeAgg.h,v 1.25 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -18,7 +18,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsAgg(Agg *node); -extern AggState *ExecInitAgg(Agg *node, EState *estate); +extern AggState *ExecInitAgg(Agg *node, EState *estate, int eflags); extern TupleTableSlot *ExecAgg(AggState *node); extern void ExecEndAgg(AggState *node); extern void ExecReScanAgg(AggState *node, ExprContext *exprCtxt); diff --git a/src/include/executor/nodeAppend.h b/src/include/executor/nodeAppend.h index ce42e5b072..6b2cbf3671 100644 --- a/src/include/executor/nodeAppend.h +++ b/src/include/executor/nodeAppend.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeAppend.h,v 1.23 2004/12/31 22:03:29 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeAppend.h,v 1.24 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsAppend(Append *node); -extern AppendState *ExecInitAppend(Append *node, EState *estate); +extern AppendState *ExecInitAppend(Append *node, EState *estate, int eflags); extern TupleTableSlot *ExecAppend(AppendState *node); extern void ExecEndAppend(AppendState *node); extern void ExecReScanAppend(AppendState *node, ExprContext *exprCtxt); diff --git a/src/include/executor/nodeBitmapAnd.h b/src/include/executor/nodeBitmapAnd.h index 320fc71ab7..b13ca7e6fa 100644 --- a/src/include/executor/nodeBitmapAnd.h +++ b/src/include/executor/nodeBitmapAnd.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeBitmapAnd.h,v 1.1 2005/04/19 22:35:17 tgl Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeBitmapAnd.h,v 1.2 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsBitmapAnd(BitmapAnd *node); -extern BitmapAndState *ExecInitBitmapAnd(BitmapAnd *node, EState *estate); +extern BitmapAndState *ExecInitBitmapAnd(BitmapAnd *node, EState *estate, int eflags); extern Node *MultiExecBitmapAnd(BitmapAndState *node); extern void ExecEndBitmapAnd(BitmapAndState *node); extern void ExecReScanBitmapAnd(BitmapAndState *node, ExprContext *exprCtxt); diff --git a/src/include/executor/nodeBitmapHeapscan.h b/src/include/executor/nodeBitmapHeapscan.h index 48c4b6ad79..f61fd8946d 100644 --- a/src/include/executor/nodeBitmapHeapscan.h +++ b/src/include/executor/nodeBitmapHeapscan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeBitmapHeapscan.h,v 1.1 2005/04/19 22:35:17 tgl Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeBitmapHeapscan.h,v 1.2 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsBitmapHeapScan(BitmapHeapScan *node); -extern BitmapHeapScanState *ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate); +extern BitmapHeapScanState *ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecBitmapHeapScan(BitmapHeapScanState *node); extern void ExecEndBitmapHeapScan(BitmapHeapScanState *node); extern void ExecBitmapHeapReScan(BitmapHeapScanState *node, ExprContext *exprCtxt); diff --git a/src/include/executor/nodeBitmapIndexscan.h b/src/include/executor/nodeBitmapIndexscan.h index 7ca5553abb..0dedb96804 100644 --- a/src/include/executor/nodeBitmapIndexscan.h +++ b/src/include/executor/nodeBitmapIndexscan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeBitmapIndexscan.h,v 1.1 2005/04/19 22:35:17 tgl Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeBitmapIndexscan.h,v 1.2 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsBitmapIndexScan(BitmapIndexScan *node); -extern BitmapIndexScanState *ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate); +extern BitmapIndexScanState *ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags); extern Node *MultiExecBitmapIndexScan(BitmapIndexScanState *node); extern void ExecEndBitmapIndexScan(BitmapIndexScanState *node); extern void ExecBitmapIndexReScan(BitmapIndexScanState *node, ExprContext *exprCtxt); diff --git a/src/include/executor/nodeBitmapOr.h b/src/include/executor/nodeBitmapOr.h index 927231a708..6e71666448 100644 --- a/src/include/executor/nodeBitmapOr.h +++ b/src/include/executor/nodeBitmapOr.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeBitmapOr.h,v 1.1 2005/04/19 22:35:17 tgl Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeBitmapOr.h,v 1.2 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsBitmapOr(BitmapOr *node); -extern BitmapOrState *ExecInitBitmapOr(BitmapOr *node, EState *estate); +extern BitmapOrState *ExecInitBitmapOr(BitmapOr *node, EState *estate, int eflags); extern Node *MultiExecBitmapOr(BitmapOrState *node); extern void ExecEndBitmapOr(BitmapOrState *node); extern void ExecReScanBitmapOr(BitmapOrState *node, ExprContext *exprCtxt); diff --git a/src/include/executor/nodeFunctionscan.h b/src/include/executor/nodeFunctionscan.h index e4bb8eb57c..7d8abfa837 100644 --- a/src/include/executor/nodeFunctionscan.h +++ b/src/include/executor/nodeFunctionscan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeFunctionscan.h,v 1.7 2004/12/31 22:03:29 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeFunctionscan.h,v 1.8 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsFunctionScan(FunctionScan *node); -extern FunctionScanState *ExecInitFunctionScan(FunctionScan *node, EState *estate); +extern FunctionScanState *ExecInitFunctionScan(FunctionScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecFunctionScan(FunctionScanState *node); extern void ExecEndFunctionScan(FunctionScanState *node); extern void ExecFunctionMarkPos(FunctionScanState *node); diff --git a/src/include/executor/nodeGroup.h b/src/include/executor/nodeGroup.h index 719e1ff494..173e85278f 100644 --- a/src/include/executor/nodeGroup.h +++ b/src/include/executor/nodeGroup.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeGroup.h,v 1.28 2004/12/31 22:03:29 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeGroup.h,v 1.29 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsGroup(Group *node); -extern GroupState *ExecInitGroup(Group *node, EState *estate); +extern GroupState *ExecInitGroup(Group *node, EState *estate, int eflags); extern TupleTableSlot *ExecGroup(GroupState *node); extern void ExecEndGroup(GroupState *node); extern void ExecReScanGroup(GroupState *node, ExprContext *exprCtxt); diff --git a/src/include/executor/nodeHash.h b/src/include/executor/nodeHash.h index 55715c8a60..61dfafb024 100644 --- a/src/include/executor/nodeHash.h +++ b/src/include/executor/nodeHash.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeHash.h,v 1.38 2005/10/15 02:49:44 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeHash.h,v 1.39 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsHash(Hash *node); -extern HashState *ExecInitHash(Hash *node, EState *estate); +extern HashState *ExecInitHash(Hash *node, EState *estate, int eflags); extern TupleTableSlot *ExecHash(HashState *node); extern Node *MultiExecHash(HashState *node); extern void ExecEndHash(HashState *node); diff --git a/src/include/executor/nodeHashjoin.h b/src/include/executor/nodeHashjoin.h index 8590d6b189..8cdb3857fc 100644 --- a/src/include/executor/nodeHashjoin.h +++ b/src/include/executor/nodeHashjoin.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeHashjoin.h,v 1.30 2005/10/15 02:49:44 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeHashjoin.h,v 1.31 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -18,7 +18,7 @@ #include "storage/buffile.h" extern int ExecCountSlotsHashJoin(HashJoin *node); -extern HashJoinState *ExecInitHashJoin(HashJoin *node, EState *estate); +extern HashJoinState *ExecInitHashJoin(HashJoin *node, EState *estate, int eflags); extern TupleTableSlot *ExecHashJoin(HashJoinState *node); extern void ExecEndHashJoin(HashJoinState *node); extern void ExecReScanHashJoin(HashJoinState *node, ExprContext *exprCtxt); diff --git a/src/include/executor/nodeIndexscan.h b/src/include/executor/nodeIndexscan.h index d36defaa01..5237617246 100644 --- a/src/include/executor/nodeIndexscan.h +++ b/src/include/executor/nodeIndexscan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeIndexscan.h,v 1.26 2006/01/25 20:29:24 tgl Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeIndexscan.h,v 1.27 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsIndexScan(IndexScan *node); -extern IndexScanState *ExecInitIndexScan(IndexScan *node, EState *estate); +extern IndexScanState *ExecInitIndexScan(IndexScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecIndexScan(IndexScanState *node); extern void ExecEndIndexScan(IndexScanState *node); extern void ExecIndexMarkPos(IndexScanState *node); diff --git a/src/include/executor/nodeLimit.h b/src/include/executor/nodeLimit.h index 8722766e59..cecaf663e3 100644 --- a/src/include/executor/nodeLimit.h +++ b/src/include/executor/nodeLimit.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeLimit.h,v 1.11 2004/12/31 22:03:29 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeLimit.h,v 1.12 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsLimit(Limit *node); -extern LimitState *ExecInitLimit(Limit *node, EState *estate); +extern LimitState *ExecInitLimit(Limit *node, EState *estate, int eflags); extern TupleTableSlot *ExecLimit(LimitState *node); extern void ExecEndLimit(LimitState *node); extern void ExecReScanLimit(LimitState *node, ExprContext *exprCtxt); diff --git a/src/include/executor/nodeMaterial.h b/src/include/executor/nodeMaterial.h index 80eee49dcd..f1caf02625 100644 --- a/src/include/executor/nodeMaterial.h +++ b/src/include/executor/nodeMaterial.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeMaterial.h,v 1.23 2004/12/31 22:03:29 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeMaterial.h,v 1.24 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsMaterial(Material *node); -extern MaterialState *ExecInitMaterial(Material *node, EState *estate); +extern MaterialState *ExecInitMaterial(Material *node, EState *estate, int eflags); extern TupleTableSlot *ExecMaterial(MaterialState *node); extern void ExecEndMaterial(MaterialState *node); extern void ExecMaterialMarkPos(MaterialState *node); diff --git a/src/include/executor/nodeMergejoin.h b/src/include/executor/nodeMergejoin.h index 66ef0bbf41..4247af4a78 100644 --- a/src/include/executor/nodeMergejoin.h +++ b/src/include/executor/nodeMergejoin.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeMergejoin.h,v 1.22 2004/12/31 22:03:29 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeMergejoin.h,v 1.23 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsMergeJoin(MergeJoin *node); -extern MergeJoinState *ExecInitMergeJoin(MergeJoin *node, EState *estate); +extern MergeJoinState *ExecInitMergeJoin(MergeJoin *node, EState *estate, int eflags); extern TupleTableSlot *ExecMergeJoin(MergeJoinState *node); extern void ExecEndMergeJoin(MergeJoinState *node); extern void ExecReScanMergeJoin(MergeJoinState *node, ExprContext *exprCtxt); diff --git a/src/include/executor/nodeNestloop.h b/src/include/executor/nodeNestloop.h index 00bbafae00..9705585d5e 100644 --- a/src/include/executor/nodeNestloop.h +++ b/src/include/executor/nodeNestloop.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeNestloop.h,v 1.23 2004/12/31 22:03:29 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeNestloop.h,v 1.24 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsNestLoop(NestLoop *node); -extern NestLoopState *ExecInitNestLoop(NestLoop *node, EState *estate); +extern NestLoopState *ExecInitNestLoop(NestLoop *node, EState *estate, int eflags); extern TupleTableSlot *ExecNestLoop(NestLoopState *node); extern void ExecEndNestLoop(NestLoopState *node); extern void ExecReScanNestLoop(NestLoopState *node, ExprContext *exprCtxt); diff --git a/src/include/executor/nodeResult.h b/src/include/executor/nodeResult.h index 87fe93eeb3..b32b5299a9 100644 --- a/src/include/executor/nodeResult.h +++ b/src/include/executor/nodeResult.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeResult.h,v 1.20 2004/12/31 22:03:29 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeResult.h,v 1.21 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsResult(Result *node); -extern ResultState *ExecInitResult(Result *node, EState *estate); +extern ResultState *ExecInitResult(Result *node, EState *estate, int eflags); extern TupleTableSlot *ExecResult(ResultState *node); extern void ExecEndResult(ResultState *node); extern void ExecReScanResult(ResultState *node, ExprContext *exprCtxt); diff --git a/src/include/executor/nodeSeqscan.h b/src/include/executor/nodeSeqscan.h index c768571dd4..a3e7877995 100644 --- a/src/include/executor/nodeSeqscan.h +++ b/src/include/executor/nodeSeqscan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeSeqscan.h,v 1.22 2004/12/31 22:03:29 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeSeqscan.h,v 1.23 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsSeqScan(SeqScan *node); -extern SeqScanState *ExecInitSeqScan(SeqScan *node, EState *estate); +extern SeqScanState *ExecInitSeqScan(SeqScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecSeqScan(SeqScanState *node); extern void ExecEndSeqScan(SeqScanState *node); extern void ExecSeqMarkPos(SeqScanState *node); diff --git a/src/include/executor/nodeSetOp.h b/src/include/executor/nodeSetOp.h index a276f016be..2c2aaf202a 100644 --- a/src/include/executor/nodeSetOp.h +++ b/src/include/executor/nodeSetOp.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeSetOp.h,v 1.11 2004/12/31 22:03:29 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeSetOp.h,v 1.12 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsSetOp(SetOp *node); -extern SetOpState *ExecInitSetOp(SetOp *node, EState *estate); +extern SetOpState *ExecInitSetOp(SetOp *node, EState *estate, int eflags); extern TupleTableSlot *ExecSetOp(SetOpState *node); extern void ExecEndSetOp(SetOpState *node); extern void ExecReScanSetOp(SetOpState *node, ExprContext *exprCtxt); diff --git a/src/include/executor/nodeSort.h b/src/include/executor/nodeSort.h index cf50914dce..e27ed0f3a2 100644 --- a/src/include/executor/nodeSort.h +++ b/src/include/executor/nodeSort.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeSort.h,v 1.20 2004/12/31 22:03:29 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeSort.h,v 1.21 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsSort(Sort *node); -extern SortState *ExecInitSort(Sort *node, EState *estate); +extern SortState *ExecInitSort(Sort *node, EState *estate, int eflags); extern TupleTableSlot *ExecSort(SortState *node); extern void ExecEndSort(SortState *node); extern void ExecSortMarkPos(SortState *node); diff --git a/src/include/executor/nodeSubplan.h b/src/include/executor/nodeSubplan.h index 8e6450c43d..a005ac127c 100644 --- a/src/include/executor/nodeSubplan.h +++ b/src/include/executor/nodeSubplan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeSubplan.h,v 1.22 2004/12/31 22:03:29 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeSubplan.h,v 1.23 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -16,7 +16,7 @@ #include "nodes/execnodes.h" -extern void ExecInitSubPlan(SubPlanState *node, EState *estate); +extern void ExecInitSubPlan(SubPlanState *node, EState *estate, int eflags); extern Datum ExecSubPlan(SubPlanState *node, ExprContext *econtext, bool *isNull, diff --git a/src/include/executor/nodeSubqueryscan.h b/src/include/executor/nodeSubqueryscan.h index 180a9ab711..488dd8b914 100644 --- a/src/include/executor/nodeSubqueryscan.h +++ b/src/include/executor/nodeSubqueryscan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeSubqueryscan.h,v 1.11 2004/12/31 22:03:29 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeSubqueryscan.h,v 1.12 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsSubqueryScan(SubqueryScan *node); -extern SubqueryScanState *ExecInitSubqueryScan(SubqueryScan *node, EState *estate); +extern SubqueryScanState *ExecInitSubqueryScan(SubqueryScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecSubqueryScan(SubqueryScanState *node); extern void ExecEndSubqueryScan(SubqueryScanState *node); extern void ExecSubqueryReScan(SubqueryScanState *node, ExprContext *exprCtxt); diff --git a/src/include/executor/nodeTidscan.h b/src/include/executor/nodeTidscan.h index 49491f74c8..25c1224b7f 100644 --- a/src/include/executor/nodeTidscan.h +++ b/src/include/executor/nodeTidscan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeTidscan.h,v 1.15 2004/12/31 22:03:29 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeTidscan.h,v 1.16 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsTidScan(TidScan *node); -extern TidScanState *ExecInitTidScan(TidScan *node, EState *estate); +extern TidScanState *ExecInitTidScan(TidScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecTidScan(TidScanState *node); extern void ExecEndTidScan(TidScanState *node); extern void ExecTidMarkPos(TidScanState *node); diff --git a/src/include/executor/nodeUnique.h b/src/include/executor/nodeUnique.h index 0142974a41..db62436260 100644 --- a/src/include/executor/nodeUnique.h +++ b/src/include/executor/nodeUnique.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeUnique.h,v 1.20 2004/12/31 22:03:29 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeUnique.h,v 1.21 2006/02/28 04:10:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include "nodes/execnodes.h" extern int ExecCountSlotsUnique(Unique *node); -extern UniqueState *ExecInitUnique(Unique *node, EState *estate); +extern UniqueState *ExecInitUnique(Unique *node, EState *estate, int eflags); extern TupleTableSlot *ExecUnique(UniqueState *node); extern void ExecEndUnique(UniqueState *node); extern void ExecReScanUnique(UniqueState *node, ExprContext *exprCtxt);