1996-07-09 08:22:35 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* executor.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* support for the POSTGRES executor module
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*
|
2009-01-01 18:24:05 +01:00
|
|
|
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
2009-12-07 06:22:23 +01:00
|
|
|
* $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.164 2009/12/07 05:22:23 tgl Exp $
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef EXECUTOR_H
|
|
|
|
#define EXECUTOR_H
|
|
|
|
|
1999-07-16 01:04:24 +02:00
|
|
|
#include "executor/execdesc.h"
|
2007-02-20 18:32:18 +01:00
|
|
|
#include "nodes/parsenodes.h"
|
1996-11-05 09:18:44 +01:00
|
|
|
|
2002-12-05 16:50:39 +01:00
|
|
|
|
2006-02-28 05:10:28 +01:00
|
|
|
/*
|
|
|
|
* 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
|
2006-10-04 02:30:14 +02:00
|
|
|
* through complete recalculation. Note that a parameter change forces a
|
2006-02-28 05:10:28 +01:00
|
|
|
* 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.
|
|
|
|
*/
|
2006-10-04 02:30:14 +02:00
|
|
|
#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 */
|
2006-02-28 05:10:28 +01:00
|
|
|
|
|
|
|
|
2004-03-17 02:02:24 +01:00
|
|
|
/*
|
|
|
|
* ExecEvalExpr was formerly a function containing a switch statement;
|
|
|
|
* now it's just a macro invoking the function pointed to by an ExprState
|
|
|
|
* node. Beware of double evaluation of the ExprState argument!
|
|
|
|
*/
|
|
|
|
#define ExecEvalExpr(expr, econtext, isNull, isDone) \
|
|
|
|
((*(expr)->evalfunc) (expr, econtext, isNull, isDone))
|
|
|
|
|
|
|
|
|
2008-11-19 02:10:24 +01:00
|
|
|
/* Hook for plugins to get control in ExecutorStart() */
|
|
|
|
typedef void (*ExecutorStart_hook_type) (QueryDesc *queryDesc, int eflags);
|
|
|
|
extern PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook;
|
|
|
|
|
2008-07-18 20:23:47 +02:00
|
|
|
/* Hook for plugins to get control in ExecutorRun() */
|
2008-10-31 22:07:55 +01:00
|
|
|
typedef void (*ExecutorRun_hook_type) (QueryDesc *queryDesc,
|
2009-06-11 16:49:15 +02:00
|
|
|
ScanDirection direction,
|
|
|
|
long count);
|
2008-07-18 20:23:47 +02:00
|
|
|
extern PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook;
|
|
|
|
|
2008-11-19 02:10:24 +01:00
|
|
|
/* Hook for plugins to get control in ExecutorEnd() */
|
|
|
|
typedef void (*ExecutorEnd_hook_type) (QueryDesc *queryDesc);
|
|
|
|
extern PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook;
|
|
|
|
|
2008-07-18 20:23:47 +02:00
|
|
|
|
1996-07-09 08:22:35 +02:00
|
|
|
/*
|
|
|
|
* prototypes from functions in execAmi.c
|
|
|
|
*/
|
2003-08-08 23:42:59 +02:00
|
|
|
extern void ExecReScan(PlanState *node, ExprContext *exprCtxt);
|
|
|
|
extern void ExecMarkPos(PlanState *node);
|
|
|
|
extern void ExecRestrPos(PlanState *node);
|
2002-11-30 06:21:03 +01:00
|
|
|
extern bool ExecSupportsMarkRestore(NodeTag plantype);
|
2003-03-10 04:53:52 +01:00
|
|
|
extern bool ExecSupportsBackwardScan(Plan *node);
|
2009-09-13 00:12:09 +02:00
|
|
|
extern bool ExecMaterializesOutput(NodeTag plantype);
|
1996-07-09 08:22:35 +02:00
|
|
|
|
2007-06-11 03:16:30 +02:00
|
|
|
/*
|
|
|
|
* prototypes from functions in execCurrent.c
|
|
|
|
*/
|
2007-11-15 23:25:18 +01:00
|
|
|
extern bool execCurrentOf(CurrentOfExpr *cexpr,
|
2007-11-15 22:14:46 +01:00
|
|
|
ExprContext *econtext,
|
|
|
|
Oid table_oid,
|
|
|
|
ItemPointer current_tid);
|
2007-06-11 03:16:30 +02:00
|
|
|
|
2003-01-11 00:54:24 +01:00
|
|
|
/*
|
|
|
|
* prototypes from functions in execGrouping.c
|
|
|
|
*/
|
2005-03-16 22:38:10 +01:00
|
|
|
extern bool execTuplesMatch(TupleTableSlot *slot1,
|
2005-10-15 04:49:52 +02:00
|
|
|
TupleTableSlot *slot2,
|
|
|
|
int numCols,
|
|
|
|
AttrNumber *matchColIdx,
|
|
|
|
FmgrInfo *eqfunctions,
|
|
|
|
MemoryContext evalContext);
|
2005-03-16 22:38:10 +01:00
|
|
|
extern bool execTuplesUnequal(TupleTableSlot *slot1,
|
2005-10-15 04:49:52 +02:00
|
|
|
TupleTableSlot *slot2,
|
|
|
|
int numCols,
|
|
|
|
AttrNumber *matchColIdx,
|
|
|
|
FmgrInfo *eqfunctions,
|
|
|
|
MemoryContext evalContext);
|
2007-01-10 19:06:05 +01:00
|
|
|
extern FmgrInfo *execTuplesMatchPrepare(int numCols,
|
|
|
|
Oid *eqOperators);
|
|
|
|
extern void execTuplesHashPrepare(int numCols,
|
|
|
|
Oid *eqOperators,
|
|
|
|
FmgrInfo **eqFunctions,
|
|
|
|
FmgrInfo **hashFunctions);
|
2003-01-11 00:54:24 +01:00
|
|
|
extern TupleHashTable BuildTupleHashTable(int numCols, AttrNumber *keyColIdx,
|
2003-08-04 02:43:34 +02:00
|
|
|
FmgrInfo *eqfunctions,
|
|
|
|
FmgrInfo *hashfunctions,
|
|
|
|
int nbuckets, Size entrysize,
|
|
|
|
MemoryContext tablecxt,
|
|
|
|
MemoryContext tempcxt);
|
2003-01-11 00:54:24 +01:00
|
|
|
extern TupleHashEntry LookupTupleHashEntry(TupleHashTable hashtable,
|
2003-08-04 02:43:34 +02:00
|
|
|
TupleTableSlot *slot,
|
|
|
|
bool *isnew);
|
2007-02-06 03:59:15 +01:00
|
|
|
extern TupleHashEntry FindTupleHashEntry(TupleHashTable hashtable,
|
2007-11-15 22:14:46 +01:00
|
|
|
TupleTableSlot *slot,
|
|
|
|
FmgrInfo *eqfunctions,
|
|
|
|
FmgrInfo *hashfunctions);
|
2003-01-11 00:54:24 +01:00
|
|
|
|
1996-07-09 08:22:35 +02:00
|
|
|
/*
|
|
|
|
* prototypes from functions in execJunk.c
|
|
|
|
*/
|
2004-10-07 20:38:51 +02:00
|
|
|
extern JunkFilter *ExecInitJunkFilter(List *targetList, bool hasoid,
|
2001-10-25 07:50:21 +02:00
|
|
|
TupleTableSlot *slot);
|
2004-10-07 20:38:51 +02:00
|
|
|
extern JunkFilter *ExecInitJunkFilterConversion(List *targetList,
|
2005-10-15 04:49:52 +02:00
|
|
|
TupleDesc cleanTupType,
|
|
|
|
TupleTableSlot *slot);
|
2006-12-04 03:06:55 +01:00
|
|
|
extern AttrNumber ExecFindJunkAttribute(JunkFilter *junkfilter,
|
2007-11-15 22:14:46 +01:00
|
|
|
const char *attrName);
|
2006-12-04 03:06:55 +01:00
|
|
|
extern Datum ExecGetJunkAttribute(TupleTableSlot *slot, AttrNumber attno,
|
2007-11-15 22:14:46 +01:00
|
|
|
bool *isNull);
|
2005-03-16 22:38:10 +01:00
|
|
|
extern TupleTableSlot *ExecFilterJunk(JunkFilter *junkfilter,
|
2005-10-15 04:49:52 +02:00
|
|
|
TupleTableSlot *slot);
|
1997-09-08 23:56:23 +02:00
|
|
|
extern HeapTuple ExecRemoveJunk(JunkFilter *junkfilter, TupleTableSlot *slot);
|
1996-07-09 08:22:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* prototypes from functions in execMain.c
|
|
|
|
*/
|
2006-02-28 05:10:28 +01:00
|
|
|
extern void ExecutorStart(QueryDesc *queryDesc, int eflags);
|
2008-11-19 02:10:24 +01:00
|
|
|
extern void standard_ExecutorStart(QueryDesc *queryDesc, int eflags);
|
2008-10-31 22:07:55 +01:00
|
|
|
extern void ExecutorRun(QueryDesc *queryDesc,
|
2009-06-11 16:49:15 +02:00
|
|
|
ScanDirection direction, long count);
|
2008-10-31 22:07:55 +01:00
|
|
|
extern void standard_ExecutorRun(QueryDesc *queryDesc,
|
2009-06-11 16:49:15 +02:00
|
|
|
ScanDirection direction, long count);
|
2002-12-05 16:50:39 +01:00
|
|
|
extern void ExecutorEnd(QueryDesc *queryDesc);
|
2008-11-19 02:10:24 +01:00
|
|
|
extern void standard_ExecutorEnd(QueryDesc *queryDesc);
|
2003-03-11 20:40:24 +01:00
|
|
|
extern void ExecutorRewind(QueryDesc *queryDesc);
|
2008-03-28 01:21:56 +01:00
|
|
|
extern void InitResultRelInfo(ResultRelInfo *resultRelInfo,
|
|
|
|
Relation resultRelationDesc,
|
|
|
|
Index resultRelationIndex,
|
|
|
|
CmdType operation,
|
|
|
|
bool doInstrument);
|
2007-08-15 23:39:50 +02:00
|
|
|
extern ResultRelInfo *ExecGetTriggerResultRel(EState *estate, Oid relid);
|
2004-01-22 03:23:21 +01:00
|
|
|
extern bool ExecContextForcesOids(PlanState *planstate, bool *hasoids);
|
2003-07-21 19:05:12 +02:00
|
|
|
extern void ExecConstraints(ResultRelInfo *resultRelInfo,
|
2001-03-22 05:01:46 +01:00
|
|
|
TupleTableSlot *slot, EState *estate);
|
Re-implement EvalPlanQual processing to improve its performance and eliminate
a lot of strange behaviors that occurred in join cases. We now identify the
"current" row for every joined relation in UPDATE, DELETE, and SELECT FOR
UPDATE/SHARE queries. If an EvalPlanQual recheck is necessary, we jam the
appropriate row into each scan node in the rechecking plan, forcing it to emit
only that one row. The former behavior could rescan the whole of each joined
relation for each recheck, which was terrible for performance, and what's much
worse could result in duplicated output tuples.
Also, the original implementation of EvalPlanQual could not re-use the recheck
execution tree --- it had to go through a full executor init and shutdown for
every row to be tested. To avoid this overhead, I've associated a special
runtime Param with each LockRows or ModifyTable plan node, and arranged to
make every scan node below such a node depend on that Param. Thus, by
signaling a change in that Param, the EPQ machinery can just rescan the
already-built test plan.
This patch also adds a prohibition on set-returning functions in the
targetlist of SELECT FOR UPDATE/SHARE. This is needed to avoid the
duplicate-output-tuple problem. It seems fairly reasonable since the
other restrictions on SELECT FOR UPDATE are meant to ensure that there
is a unique correspondence between source tuples and result tuples,
which an output SRF destroys as much as anything else does.
2009-10-26 03:26:45 +01:00
|
|
|
extern TupleTableSlot *EvalPlanQual(EState *estate, EPQState *epqstate,
|
|
|
|
Relation relation, Index rti,
|
2007-11-30 22:22:54 +01:00
|
|
|
ItemPointer tid, TransactionId priorXmax);
|
Re-implement EvalPlanQual processing to improve its performance and eliminate
a lot of strange behaviors that occurred in join cases. We now identify the
"current" row for every joined relation in UPDATE, DELETE, and SELECT FOR
UPDATE/SHARE queries. If an EvalPlanQual recheck is necessary, we jam the
appropriate row into each scan node in the rechecking plan, forcing it to emit
only that one row. The former behavior could rescan the whole of each joined
relation for each recheck, which was terrible for performance, and what's much
worse could result in duplicated output tuples.
Also, the original implementation of EvalPlanQual could not re-use the recheck
execution tree --- it had to go through a full executor init and shutdown for
every row to be tested. To avoid this overhead, I've associated a special
runtime Param with each LockRows or ModifyTable plan node, and arranged to
make every scan node below such a node depend on that Param. Thus, by
signaling a change in that Param, the EPQ machinery can just rescan the
already-built test plan.
This patch also adds a prohibition on set-returning functions in the
targetlist of SELECT FOR UPDATE/SHARE. This is needed to avoid the
duplicate-output-tuple problem. It seems fairly reasonable since the
other restrictions on SELECT FOR UPDATE are meant to ensure that there
is a unique correspondence between source tuples and result tuples,
which an output SRF destroys as much as anything else does.
2009-10-26 03:26:45 +01:00
|
|
|
extern HeapTuple EvalPlanQualFetch(EState *estate, Relation relation,
|
|
|
|
int lockmode, ItemPointer tid, TransactionId priorXmax);
|
|
|
|
extern void EvalPlanQualInit(EPQState *epqstate, EState *estate,
|
|
|
|
Plan *subplan, int epqParam);
|
|
|
|
extern void EvalPlanQualSetPlan(EPQState *epqstate, Plan *subplan);
|
|
|
|
extern void EvalPlanQualAddRowMark(EPQState *epqstate, ExecRowMark *erm);
|
|
|
|
extern void EvalPlanQualSetTuple(EPQState *epqstate, Index rti,
|
|
|
|
HeapTuple tuple);
|
|
|
|
extern HeapTuple EvalPlanQualGetTuple(EPQState *epqstate, Index rti);
|
|
|
|
#define EvalPlanQualSetSlot(epqstate, slot) ((epqstate)->origslot = (slot))
|
|
|
|
extern void EvalPlanQualFetchRowMarks(EPQState *epqstate);
|
|
|
|
extern TupleTableSlot *EvalPlanQualNext(EPQState *epqstate);
|
|
|
|
extern void EvalPlanQualBegin(EPQState *epqstate, EState *parentestate);
|
|
|
|
extern void EvalPlanQualEnd(EPQState *epqstate);
|
2006-08-12 04:52:06 +02:00
|
|
|
extern DestReceiver *CreateIntoRelDestReceiver(void);
|
1999-05-25 18:15:34 +02:00
|
|
|
|
1996-07-09 08:22:35 +02:00
|
|
|
/*
|
|
|
|
* prototypes from functions in execProcnode.c
|
|
|
|
*/
|
2006-02-28 05:10:28 +01:00
|
|
|
extern PlanState *ExecInitNode(Plan *node, EState *estate, int eflags);
|
2003-08-08 23:42:59 +02:00
|
|
|
extern TupleTableSlot *ExecProcNode(PlanState *node);
|
2005-04-16 22:07:35 +02:00
|
|
|
extern Node *MultiExecProcNode(PlanState *node);
|
2003-08-08 23:42:59 +02:00
|
|
|
extern void ExecEndNode(PlanState *node);
|
1996-07-09 08:22:35 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* prototypes from functions in execQual.c
|
|
|
|
*/
|
2004-04-01 23:28:47 +02:00
|
|
|
extern Datum GetAttributeByNum(HeapTupleHeader tuple, AttrNumber attrno,
|
2001-03-22 05:01:46 +01:00
|
|
|
bool *isNull);
|
2004-04-01 23:28:47 +02:00
|
|
|
extern Datum GetAttributeByName(HeapTupleHeader tuple, const char *attname,
|
2001-03-22 05:01:46 +01:00
|
|
|
bool *isNull);
|
2003-08-08 23:42:59 +02:00
|
|
|
extern Tuplestorestate *ExecMakeTableFunctionResult(ExprState *funcexpr,
|
2002-09-04 22:31:48 +02:00
|
|
|
ExprContext *econtext,
|
2008-10-29 01:00:39 +01:00
|
|
|
TupleDesc expectedDesc,
|
|
|
|
bool randomAccess);
|
2003-08-08 23:42:59 +02:00
|
|
|
extern Datum ExecEvalExprSwitchContext(ExprState *expression, ExprContext *econtext,
|
2001-03-22 05:01:46 +01:00
|
|
|
bool *isNull, ExprDoneCond *isDone);
|
2003-08-08 23:42:59 +02:00
|
|
|
extern ExprState *ExecInitExpr(Expr *node, PlanState *parent);
|
2002-12-15 17:17:59 +01:00
|
|
|
extern ExprState *ExecPrepareExpr(Expr *node, EState *estate);
|
2000-01-20 00:55:03 +01:00
|
|
|
extern bool ExecQual(List *qual, ExprContext *econtext, bool resultForNull);
|
1997-09-08 23:56:23 +02:00
|
|
|
extern int ExecTargetListLength(List *targetlist);
|
2000-08-21 22:55:31 +02:00
|
|
|
extern int ExecCleanTargetListLength(List *targetlist);
|
2000-08-24 05:29:15 +02:00
|
|
|
extern TupleTableSlot *ExecProject(ProjectionInfo *projInfo,
|
2001-03-22 05:01:46 +01:00
|
|
|
ExprDoneCond *isDone);
|
1996-07-09 08:22:35 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* prototypes from functions in execScan.c
|
|
|
|
*/
|
2003-08-08 23:42:59 +02:00
|
|
|
typedef TupleTableSlot *(*ExecScanAccessMtd) (ScanState *node);
|
Re-implement EvalPlanQual processing to improve its performance and eliminate
a lot of strange behaviors that occurred in join cases. We now identify the
"current" row for every joined relation in UPDATE, DELETE, and SELECT FOR
UPDATE/SHARE queries. If an EvalPlanQual recheck is necessary, we jam the
appropriate row into each scan node in the rechecking plan, forcing it to emit
only that one row. The former behavior could rescan the whole of each joined
relation for each recheck, which was terrible for performance, and what's much
worse could result in duplicated output tuples.
Also, the original implementation of EvalPlanQual could not re-use the recheck
execution tree --- it had to go through a full executor init and shutdown for
every row to be tested. To avoid this overhead, I've associated a special
runtime Param with each LockRows or ModifyTable plan node, and arranged to
make every scan node below such a node depend on that Param. Thus, by
signaling a change in that Param, the EPQ machinery can just rescan the
already-built test plan.
This patch also adds a prohibition on set-returning functions in the
targetlist of SELECT FOR UPDATE/SHARE. This is needed to avoid the
duplicate-output-tuple problem. It seems fairly reasonable since the
other restrictions on SELECT FOR UPDATE are meant to ensure that there
is a unique correspondence between source tuples and result tuples,
which an output SRF destroys as much as anything else does.
2009-10-26 03:26:45 +01:00
|
|
|
typedef bool (*ExecScanRecheckMtd) (ScanState *node, TupleTableSlot *slot);
|
2000-07-12 04:37:39 +02:00
|
|
|
|
Re-implement EvalPlanQual processing to improve its performance and eliminate
a lot of strange behaviors that occurred in join cases. We now identify the
"current" row for every joined relation in UPDATE, DELETE, and SELECT FOR
UPDATE/SHARE queries. If an EvalPlanQual recheck is necessary, we jam the
appropriate row into each scan node in the rechecking plan, forcing it to emit
only that one row. The former behavior could rescan the whole of each joined
relation for each recheck, which was terrible for performance, and what's much
worse could result in duplicated output tuples.
Also, the original implementation of EvalPlanQual could not re-use the recheck
execution tree --- it had to go through a full executor init and shutdown for
every row to be tested. To avoid this overhead, I've associated a special
runtime Param with each LockRows or ModifyTable plan node, and arranged to
make every scan node below such a node depend on that Param. Thus, by
signaling a change in that Param, the EPQ machinery can just rescan the
already-built test plan.
This patch also adds a prohibition on set-returning functions in the
targetlist of SELECT FOR UPDATE/SHARE. This is needed to avoid the
duplicate-output-tuple problem. It seems fairly reasonable since the
other restrictions on SELECT FOR UPDATE are meant to ensure that there
is a unique correspondence between source tuples and result tuples,
which an output SRF destroys as much as anything else does.
2009-10-26 03:26:45 +01:00
|
|
|
extern TupleTableSlot *ExecScan(ScanState *node, ExecScanAccessMtd accessMtd,
|
|
|
|
ExecScanRecheckMtd recheckMtd);
|
2003-08-08 23:42:59 +02:00
|
|
|
extern void ExecAssignScanProjectionInfo(ScanState *node);
|
Re-implement EvalPlanQual processing to improve its performance and eliminate
a lot of strange behaviors that occurred in join cases. We now identify the
"current" row for every joined relation in UPDATE, DELETE, and SELECT FOR
UPDATE/SHARE queries. If an EvalPlanQual recheck is necessary, we jam the
appropriate row into each scan node in the rechecking plan, forcing it to emit
only that one row. The former behavior could rescan the whole of each joined
relation for each recheck, which was terrible for performance, and what's much
worse could result in duplicated output tuples.
Also, the original implementation of EvalPlanQual could not re-use the recheck
execution tree --- it had to go through a full executor init and shutdown for
every row to be tested. To avoid this overhead, I've associated a special
runtime Param with each LockRows or ModifyTable plan node, and arranged to
make every scan node below such a node depend on that Param. Thus, by
signaling a change in that Param, the EPQ machinery can just rescan the
already-built test plan.
This patch also adds a prohibition on set-returning functions in the
targetlist of SELECT FOR UPDATE/SHARE. This is needed to avoid the
duplicate-output-tuple problem. It seems fairly reasonable since the
other restrictions on SELECT FOR UPDATE are meant to ensure that there
is a unique correspondence between source tuples and result tuples,
which an output SRF destroys as much as anything else does.
2009-10-26 03:26:45 +01:00
|
|
|
extern void ExecScanReScan(ScanState *node);
|
1996-07-09 08:22:35 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* prototypes from functions in execTuples.c
|
|
|
|
*/
|
2003-08-08 23:42:59 +02:00
|
|
|
extern void ExecInitResultTupleSlot(EState *estate, PlanState *planstate);
|
|
|
|
extern void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate);
|
2000-09-12 23:07:18 +02:00
|
|
|
extern TupleTableSlot *ExecInitExtraTupleSlot(EState *estate);
|
|
|
|
extern TupleTableSlot *ExecInitNullTupleSlot(EState *estate,
|
2001-03-22 05:01:46 +01:00
|
|
|
TupleDesc tupType);
|
2002-09-02 03:05:06 +02:00
|
|
|
extern TupleDesc ExecTypeFromTL(List *targetList, bool hasoid);
|
2003-05-06 22:26:28 +02:00
|
|
|
extern TupleDesc ExecCleanTypeFromTL(List *targetList, bool hasoid);
|
2004-05-11 00:44:49 +02:00
|
|
|
extern TupleDesc ExecTypeFromExprList(List *exprList);
|
2003-08-08 23:42:59 +02:00
|
|
|
extern void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg);
|
1996-07-09 08:22:35 +02:00
|
|
|
|
2002-07-20 07:49:28 +02:00
|
|
|
typedef struct TupOutputState
|
|
|
|
{
|
2005-03-16 22:38:10 +01:00
|
|
|
TupleTableSlot *slot;
|
2003-05-06 22:26:28 +02:00
|
|
|
DestReceiver *dest;
|
2002-07-20 07:49:28 +02:00
|
|
|
} TupOutputState;
|
|
|
|
|
2003-05-06 22:26:28 +02:00
|
|
|
extern TupOutputState *begin_tup_output_tupdesc(DestReceiver *dest,
|
2003-08-04 02:43:34 +02:00
|
|
|
TupleDesc tupdesc);
|
2009-07-22 19:00:23 +02:00
|
|
|
extern void do_tup_output(TupOutputState *tstate, Datum *values, bool *isnull);
|
2002-07-20 07:49:28 +02:00
|
|
|
extern void do_text_output_multiline(TupOutputState *tstate, char *text);
|
|
|
|
extern void end_tup_output(TupOutputState *tstate);
|
|
|
|
|
2002-08-29 02:17:06 +02:00
|
|
|
/*
|
|
|
|
* Write a single line of text given as a C string.
|
|
|
|
*
|
|
|
|
* Should only be used with a single-TEXT-attribute tupdesc.
|
|
|
|
*/
|
2009-07-22 19:00:23 +02:00
|
|
|
#define do_text_output_oneline(tstate, str_to_emit) \
|
2002-07-20 07:49:28 +02:00
|
|
|
do { \
|
2009-07-22 19:00:23 +02:00
|
|
|
Datum values_[1]; \
|
|
|
|
bool isnull_[1]; \
|
|
|
|
values_[0] = PointerGetDatum(cstring_to_text(str_to_emit)); \
|
|
|
|
isnull_[0] = false; \
|
|
|
|
do_tup_output(tstate, values_, isnull_); \
|
|
|
|
pfree(DatumGetPointer(values_[0])); \
|
2002-07-20 07:49:28 +02:00
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
1996-07-09 08:22:35 +02:00
|
|
|
/*
|
1999-04-16 23:27:23 +02:00
|
|
|
* prototypes from functions in execUtils.c
|
1996-07-09 08:22:35 +02:00
|
|
|
*/
|
2002-12-15 17:17:59 +01:00
|
|
|
extern EState *CreateExecutorState(void);
|
|
|
|
extern void FreeExecutorState(EState *estate);
|
|
|
|
extern ExprContext *CreateExprContext(EState *estate);
|
2006-08-04 23:33:36 +02:00
|
|
|
extern ExprContext *CreateStandaloneExprContext(void);
|
2009-07-18 21:15:42 +02:00
|
|
|
extern void FreeExprContext(ExprContext *econtext, bool isCommit);
|
2003-12-18 21:21:37 +01:00
|
|
|
extern void ReScanExprContext(ExprContext *econtext);
|
2000-07-12 04:37:39 +02:00
|
|
|
|
|
|
|
#define ResetExprContext(econtext) \
|
|
|
|
MemoryContextReset((econtext)->ecxt_per_tuple_memory)
|
|
|
|
|
2001-01-22 01:50:07 +01:00
|
|
|
extern ExprContext *MakePerTupleExprContext(EState *estate);
|
|
|
|
|
|
|
|
/* Get an EState's per-output-tuple exprcontext, making it if first use */
|
|
|
|
#define GetPerTupleExprContext(estate) \
|
|
|
|
((estate)->es_per_tuple_exprcontext ? \
|
|
|
|
(estate)->es_per_tuple_exprcontext : \
|
|
|
|
MakePerTupleExprContext(estate))
|
|
|
|
|
|
|
|
#define GetPerTupleMemoryContext(estate) \
|
|
|
|
(GetPerTupleExprContext(estate)->ecxt_per_tuple_memory)
|
|
|
|
|
|
|
|
/* Reset an EState's per-output-tuple exprcontext, if one's been created */
|
|
|
|
#define ResetPerTupleExprContext(estate) \
|
|
|
|
do { \
|
|
|
|
if ((estate)->es_per_tuple_exprcontext) \
|
|
|
|
ResetExprContext((estate)->es_per_tuple_exprcontext); \
|
|
|
|
} while (0)
|
|
|
|
|
2003-08-08 23:42:59 +02:00
|
|
|
extern void ExecAssignExprContext(EState *estate, PlanState *planstate);
|
2006-06-16 20:42:24 +02:00
|
|
|
extern void ExecAssignResultType(PlanState *planstate, TupleDesc tupDesc);
|
2003-08-08 23:42:59 +02:00
|
|
|
extern void ExecAssignResultTypeFromTL(PlanState *planstate);
|
|
|
|
extern TupleDesc ExecGetResultType(PlanState *planstate);
|
2003-01-12 05:03:34 +01:00
|
|
|
extern ProjectionInfo *ExecBuildProjectionInfo(List *targetList,
|
2003-08-04 02:43:34 +02:00
|
|
|
ExprContext *econtext,
|
2007-02-02 01:07:03 +01:00
|
|
|
TupleTableSlot *slot,
|
|
|
|
TupleDesc inputDesc);
|
|
|
|
extern void ExecAssignProjectionInfo(PlanState *planstate,
|
2007-11-15 22:14:46 +01:00
|
|
|
TupleDesc inputDesc);
|
2003-08-08 23:42:59 +02:00
|
|
|
extern void ExecFreeExprContext(PlanState *planstate);
|
|
|
|
extern TupleDesc ExecGetScanType(ScanState *scanstate);
|
2006-06-16 20:42:24 +02:00
|
|
|
extern void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc);
|
2003-08-08 23:42:59 +02:00
|
|
|
extern void ExecAssignScanTypeFromOuterPlan(ScanState *scanstate);
|
2002-12-15 17:17:59 +01:00
|
|
|
|
2005-12-03 06:51:03 +01:00
|
|
|
extern bool ExecRelationIsTargetRelation(EState *estate, Index scanrelid);
|
|
|
|
|
2005-12-02 21:03:42 +01:00
|
|
|
extern Relation ExecOpenScanRelation(EState *estate, Index scanrelid);
|
|
|
|
extern void ExecCloseScanRelation(Relation scanrel);
|
|
|
|
|
2000-11-12 01:37:02 +01:00
|
|
|
extern void ExecOpenIndices(ResultRelInfo *resultRelInfo);
|
|
|
|
extern void ExecCloseIndices(ResultRelInfo *resultRelInfo);
|
2009-07-29 22:56:21 +02:00
|
|
|
extern List *ExecInsertIndexTuples(TupleTableSlot *slot, ItemPointer tupleid,
|
|
|
|
EState *estate, bool is_vacuum_full);
|
2009-12-07 06:22:23 +01:00
|
|
|
extern bool check_exclusion_constraint(Relation heap, Relation index,
|
|
|
|
IndexInfo *indexInfo,
|
|
|
|
ItemPointer tupleid,
|
|
|
|
Datum *values, bool *isnull,
|
|
|
|
EState *estate,
|
|
|
|
bool newIndex, bool errorOK);
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2002-05-12 22:10:05 +02:00
|
|
|
extern void RegisterExprContextCallback(ExprContext *econtext,
|
2002-09-04 22:31:48 +02:00
|
|
|
ExprContextCallbackFunction function,
|
|
|
|
Datum arg);
|
2002-05-12 22:10:05 +02:00
|
|
|
extern void UnregisterExprContextCallback(ExprContext *econtext,
|
2002-09-04 22:31:48 +02:00
|
|
|
ExprContextCallbackFunction function,
|
|
|
|
Datum arg);
|
2002-05-12 22:10:05 +02:00
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* EXECUTOR_H */
|