* 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 $
*
*-------------------------------------------------------------------------
*/
double totaltime = 0;
ExplainState *es;
StringInfo str;
+ int eflags;
INSTR_TIME_SET_CURRENT(starttime);
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)
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
} 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,
* 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;
/*
* 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);
/*
/*
* Initialize the plan state tree
*/
- InitPlan(queryDesc, explainOnly);
+ InitPlan(queryDesc, eflags);
MemoryContextSwitchTo(oldcontext);
}
* ----------------------------------------------------------------
*/
static void
-InitPlan(QueryDesc *queryDesc, bool explainOnly)
+InitPlan(QueryDesc *queryDesc, int eflags)
{
CmdType operation = queryDesc->operation;
Query *parseTree = queryDesc->parsetree;
* 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
*/
intoRelationDesc = NULL;
- if (do_select_into && !explainOnly)
+ if (do_select_into && !(eflags & EXEC_FLAG_EXPLAIN_ONLY))
{
char *intoName;
Oid namespaceId;
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);
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* 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.
*
/* ------------------------------------------------------------------------
* 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;
* 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:
Assert(IsA(subplan, SubPlan));
sstate = ExecInitExprInitPlan(subplan, result);
- ExecInitSubPlan(sstate, estate);
+ ExecInitSubPlan(sstate, estate, eflags);
subps = lappend(subps, sstate);
}
result->initPlan = subps;
SubPlanState *sstate = (SubPlanState *) lfirst(l);
Assert(IsA(sstate, SubPlanState));
- ExecInitSubPlan(sstate, estate);
+ ExecInitSubPlan(sstate, estate, eflags);
}
/* Set up instrumentation for this node if requested */
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
if (es->qd->operation != CMD_UTILITY)
{
AfterTriggerBeginQuery();
- ExecutorStart(es->qd, false);
+ ExecutorStart(es->qd, 0);
}
es->status = F_EXEC_RUN;
* 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 $
*
*-------------------------------------------------------------------------
*/
* -----------------
*/
AggState *
-ExecInitAgg(Agg *node, EState *estate)
+ExecInitAgg(Agg *node, EState *estate, int eflags)
{
AggState *aggstate;
AggStatePerAgg peragg;
aggno;
ListCell *l;
+ /* check for unsupported flags */
+ Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
+
/*
* create state structure
*/
/*
* 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.
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
AppendState *
-ExecInitAppend(Append *node, EState *estate)
+ExecInitAppend(Append *node, EState *estate, int eflags)
{
AppendState *appendstate = makeNode(AppendState);
PlanState **appendplanstates;
int i;
Plan *initNode;
+ /* check for unsupported flags */
+ Assert(!(eflags & EXEC_FLAG_MARK));
+
CXT1_printf("ExecInitAppend: context is %d\n", CurrentMemoryContext);
/*
exec_append_initialize_next(appendstate);
initNode = (Plan *) list_nth(node->appendplans, i);
- appendplanstates[i] = ExecInitNode(initNode, estate);
+ appendplanstates[i] = ExecInitNode(initNode, estate, eflags);
}
/*
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
BitmapAndState *
-ExecInitBitmapAnd(BitmapAnd *node, EState *estate)
+ExecInitBitmapAnd(BitmapAnd *node, EState *estate, int eflags)
{
BitmapAndState *bitmapandstate = makeNode(BitmapAndState);
PlanState **bitmapplanstates;
ListCell *l;
Plan *initNode;
+ /* check for unsupported flags */
+ Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
+
CXT1_printf("ExecInitBitmapAnd: context is %d\n", CurrentMemoryContext);
/*
foreach(l, node->bitmapplans)
{
initNode = (Plan *) lfirst(l);
- bitmapplanstates[i] = ExecInitNode(initNode, estate);
+ bitmapplanstates[i] = ExecInitNode(initNode, estate, eflags);
i++;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
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.
* 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.
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
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
*/
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
BitmapOrState *
-ExecInitBitmapOr(BitmapOr *node, EState *estate)
+ExecInitBitmapOr(BitmapOr *node, EState *estate, int eflags)
{
BitmapOrState *bitmaporstate = makeNode(BitmapOrState);
PlanState **bitmapplanstates;
ListCell *l;
Plan *initNode;
+ /* check for unsupported flags */
+ Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
+
CXT1_printf("ExecInitBitmapOr: context is %d\n", CurrentMemoryContext);
/*
foreach(l, node->bitmapplans)
{
initNode = (Plan *) lfirst(l);
- bitmapplanstates[i] = ExecInitNode(initNode, estate);
+ bitmapplanstates[i] = ExecInitNode(initNode, estate, eflags);
i++;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
FunctionScanState *
-ExecInitFunctionScan(FunctionScan *node, EState *estate)
+ExecInitFunctionScan(FunctionScan *node, EState *estate, int eflags)
{
FunctionScanState *scanstate;
RangeTblEntry *rte;
* 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 $
*
*-------------------------------------------------------------------------
*/
* -----------------
*/
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
*/
/*
* initialize child nodes
*/
- outerPlanState(grpstate) = ExecInitNode(outerPlan(node), estate);
+ outerPlanState(grpstate) = ExecInitNode(outerPlan(node), estate, eflags);
/*
* initialize tuple type.
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
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");
/*
/*
* 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
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
HashJoinState *
-ExecInitHashJoin(HashJoin *node, EState *estate)
+ExecInitHashJoin(HashJoin *node, EState *estate, int eflags)
{
HashJoinState *hjstate;
Plan *outerNode;
List *hoperators;
ListCell *l;
+ /* check for unsupported flags */
+ Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
+
/*
* create state structure
*/
/*
* 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
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
IndexScanState *
-ExecInitIndexScan(IndexScan *node, EState *estate)
+ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
{
IndexScanState *indexstate;
Relation currentRelation;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
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
*/
* 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
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
MaterialState *
-ExecInitMaterial(Material *node, EState *estate)
+ExecInitMaterial(Material *node, EState *estate, int eflags)
{
MaterialState *matstate;
Plan *outerPlan;
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
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
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");
/*
* 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
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
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");
/*
* 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
* 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 $
*
*-------------------------------------------------------------------------
*/
* 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
*/
/*
* initialize child nodes
*/
- outerPlanState(resstate) = ExecInitNode(outerPlan(node), estate);
+ outerPlanState(resstate) = ExecInitNode(outerPlan(node), estate, eflags);
/*
* we don't use inner plan
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
SeqScanState *
-ExecInitSeqScan(SeqScan *node, EState *estate)
+ExecInitSeqScan(SeqScan *node, EState *estate, int eflags)
{
SeqScanState *scanstate;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
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
*/
/*
* 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
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* 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;
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
* 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 $
*
*-------------------------------------------------------------------------
*/
/* ----------------------------------------------------------------
* 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;
/*
* 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 */
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
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.
*/
/*
* 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);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
TidScanState *
-ExecInitTidScan(TidScan *node, EState *estate)
+ExecInitTidScan(TidScan *node, EState *estate, int eflags)
{
TidScanState *tidstate;
Relation currentRelation;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* ----------------------------------------------------------------
*/
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
*/
/*
* 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
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
AfterTriggerBeginQuery();
- ExecutorStart(queryDesc, false);
+ ExecutorStart(queryDesc, 0);
ExecutorRun(queryDesc, ForwardScanDirection, tcount);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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.
MemoryContext savePortalContext;
MemoryContext oldContext;
QueryDesc *queryDesc;
+ int eflags;
AssertArg(PortalIsValid(portal));
AssertState(portal->queryContext != NULL); /* query defined? */
*/
/*
- * 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
* 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 $
*
*-------------------------------------------------------------------------
*/
#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
/*
* 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);
/*
* 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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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,
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);
* 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 $
*
*-------------------------------------------------------------------------
*/
#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);