LCOV - code coverage report
Current view: top level - src/include/executor - executor.h (source / functions) Hit Total Coverage
Test: PostgreSQL Lines: 27 27 100.0 %
Date: 2017-09-29 15:12:54 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*-------------------------------------------------------------------------
       2             :  *
       3             :  * executor.h
       4             :  *    support for the POSTGRES executor module
       5             :  *
       6             :  *
       7             :  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
       8             :  * Portions Copyright (c) 1994, Regents of the University of California
       9             :  *
      10             :  * src/include/executor/executor.h
      11             :  *
      12             :  *-------------------------------------------------------------------------
      13             :  */
      14             : #ifndef EXECUTOR_H
      15             : #define EXECUTOR_H
      16             : 
      17             : #include "catalog/partition.h"
      18             : #include "executor/execdesc.h"
      19             : #include "nodes/parsenodes.h"
      20             : 
      21             : 
      22             : /*
      23             :  * The "eflags" argument to ExecutorStart and the various ExecInitNode
      24             :  * routines is a bitwise OR of the following flag bits, which tell the
      25             :  * called plan node what to expect.  Note that the flags will get modified
      26             :  * as they are passed down the plan tree, since an upper node may require
      27             :  * functionality in its subnode not demanded of the plan as a whole
      28             :  * (example: MergeJoin requires mark/restore capability in its inner input),
      29             :  * or an upper node may shield its input from some functionality requirement
      30             :  * (example: Materialize shields its input from needing to do backward scan).
      31             :  *
      32             :  * EXPLAIN_ONLY indicates that the plan tree is being initialized just so
      33             :  * EXPLAIN can print it out; it will not be run.  Hence, no side-effects
      34             :  * of startup should occur.  However, error checks (such as permission checks)
      35             :  * should be performed.
      36             :  *
      37             :  * REWIND indicates that the plan node should try to efficiently support
      38             :  * rescans without parameter changes.  (Nodes must support ExecReScan calls
      39             :  * in any case, but if this flag was not given, they are at liberty to do it
      40             :  * through complete recalculation.  Note that a parameter change forces a
      41             :  * full recalculation in any case.)
      42             :  *
      43             :  * BACKWARD indicates that the plan node must respect the es_direction flag.
      44             :  * When this is not passed, the plan node will only be run forwards.
      45             :  *
      46             :  * MARK indicates that the plan node must support Mark/Restore calls.
      47             :  * When this is not passed, no Mark/Restore will occur.
      48             :  *
      49             :  * SKIP_TRIGGERS tells ExecutorStart/ExecutorFinish to skip calling
      50             :  * AfterTriggerBeginQuery/AfterTriggerEndQuery.  This does not necessarily
      51             :  * mean that the plan can't queue any AFTER triggers; just that the caller
      52             :  * is responsible for there being a trigger context for them to be queued in.
      53             :  *
      54             :  * WITH/WITHOUT_OIDS tell the executor to emit tuples with or without space
      55             :  * for OIDs, respectively.  These are currently used only for CREATE TABLE AS.
      56             :  * If neither is set, the plan may or may not produce tuples including OIDs.
      57             :  */
      58             : #define EXEC_FLAG_EXPLAIN_ONLY  0x0001  /* EXPLAIN, no ANALYZE */
      59             : #define EXEC_FLAG_REWIND        0x0002  /* need efficient rescan */
      60             : #define EXEC_FLAG_BACKWARD      0x0004  /* need backward scan */
      61             : #define EXEC_FLAG_MARK          0x0008  /* need mark/restore */
      62             : #define EXEC_FLAG_SKIP_TRIGGERS 0x0010  /* skip AfterTrigger calls */
      63             : #define EXEC_FLAG_WITH_OIDS     0x0020  /* force OIDs in returned tuples */
      64             : #define EXEC_FLAG_WITHOUT_OIDS  0x0040  /* force no OIDs in returned tuples */
      65             : #define EXEC_FLAG_WITH_NO_DATA  0x0080  /* rel scannability doesn't matter */
      66             : 
      67             : 
      68             : /* Hook for plugins to get control in ExecutorStart() */
      69             : typedef void (*ExecutorStart_hook_type) (QueryDesc *queryDesc, int eflags);
      70             : extern PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook;
      71             : 
      72             : /* Hook for plugins to get control in ExecutorRun() */
      73             : typedef void (*ExecutorRun_hook_type) (QueryDesc *queryDesc,
      74             :                                        ScanDirection direction,
      75             :                                        uint64 count,
      76             :                                        bool execute_once);
      77             : extern PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook;
      78             : 
      79             : /* Hook for plugins to get control in ExecutorFinish() */
      80             : typedef void (*ExecutorFinish_hook_type) (QueryDesc *queryDesc);
      81             : extern PGDLLIMPORT ExecutorFinish_hook_type ExecutorFinish_hook;
      82             : 
      83             : /* Hook for plugins to get control in ExecutorEnd() */
      84             : typedef void (*ExecutorEnd_hook_type) (QueryDesc *queryDesc);
      85             : extern PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook;
      86             : 
      87             : /* Hook for plugins to get control in ExecCheckRTPerms() */
      88             : typedef bool (*ExecutorCheckPerms_hook_type) (List *, bool);
      89             : extern PGDLLIMPORT ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook;
      90             : 
      91             : 
      92             : /*
      93             :  * prototypes from functions in execAmi.c
      94             :  */
      95             : struct Path;                    /* avoid including relation.h here */
      96             : 
      97             : extern void ExecReScan(PlanState *node);
      98             : extern void ExecMarkPos(PlanState *node);
      99             : extern void ExecRestrPos(PlanState *node);
     100             : extern bool ExecSupportsMarkRestore(struct Path *pathnode);
     101             : extern bool ExecSupportsBackwardScan(Plan *node);
     102             : extern bool ExecMaterializesOutput(NodeTag plantype);
     103             : 
     104             : /*
     105             :  * prototypes from functions in execCurrent.c
     106             :  */
     107             : extern bool execCurrentOf(CurrentOfExpr *cexpr,
     108             :               ExprContext *econtext,
     109             :               Oid table_oid,
     110             :               ItemPointer current_tid);
     111             : 
     112             : /*
     113             :  * prototypes from functions in execGrouping.c
     114             :  */
     115             : extern bool execTuplesMatch(TupleTableSlot *slot1,
     116             :                 TupleTableSlot *slot2,
     117             :                 int numCols,
     118             :                 AttrNumber *matchColIdx,
     119             :                 FmgrInfo *eqfunctions,
     120             :                 MemoryContext evalContext);
     121             : extern bool execTuplesUnequal(TupleTableSlot *slot1,
     122             :                   TupleTableSlot *slot2,
     123             :                   int numCols,
     124             :                   AttrNumber *matchColIdx,
     125             :                   FmgrInfo *eqfunctions,
     126             :                   MemoryContext evalContext);
     127             : extern FmgrInfo *execTuplesMatchPrepare(int numCols,
     128             :                        Oid *eqOperators);
     129             : extern void execTuplesHashPrepare(int numCols,
     130             :                       Oid *eqOperators,
     131             :                       FmgrInfo **eqFunctions,
     132             :                       FmgrInfo **hashFunctions);
     133             : extern TupleHashTable BuildTupleHashTable(int numCols, AttrNumber *keyColIdx,
     134             :                     FmgrInfo *eqfunctions,
     135             :                     FmgrInfo *hashfunctions,
     136             :                     long nbuckets, Size additionalsize,
     137             :                     MemoryContext tablecxt,
     138             :                     MemoryContext tempcxt, bool use_variable_hash_iv);
     139             : extern TupleHashEntry LookupTupleHashEntry(TupleHashTable hashtable,
     140             :                      TupleTableSlot *slot,
     141             :                      bool *isnew);
     142             : extern TupleHashEntry FindTupleHashEntry(TupleHashTable hashtable,
     143             :                    TupleTableSlot *slot,
     144             :                    FmgrInfo *eqfunctions,
     145             :                    FmgrInfo *hashfunctions);
     146             : 
     147             : /*
     148             :  * prototypes from functions in execJunk.c
     149             :  */
     150             : extern JunkFilter *ExecInitJunkFilter(List *targetList, bool hasoid,
     151             :                    TupleTableSlot *slot);
     152             : extern JunkFilter *ExecInitJunkFilterConversion(List *targetList,
     153             :                              TupleDesc cleanTupType,
     154             :                              TupleTableSlot *slot);
     155             : extern AttrNumber ExecFindJunkAttribute(JunkFilter *junkfilter,
     156             :                       const char *attrName);
     157             : extern AttrNumber ExecFindJunkAttributeInTlist(List *targetlist,
     158             :                              const char *attrName);
     159             : extern Datum ExecGetJunkAttribute(TupleTableSlot *slot, AttrNumber attno,
     160             :                      bool *isNull);
     161             : extern TupleTableSlot *ExecFilterJunk(JunkFilter *junkfilter,
     162             :                TupleTableSlot *slot);
     163             : 
     164             : 
     165             : /*
     166             :  * prototypes from functions in execMain.c
     167             :  */
     168             : extern void ExecutorStart(QueryDesc *queryDesc, int eflags);
     169             : extern void standard_ExecutorStart(QueryDesc *queryDesc, int eflags);
     170             : extern void ExecutorRun(QueryDesc *queryDesc,
     171             :             ScanDirection direction, uint64 count, bool execute_once);
     172             : extern void standard_ExecutorRun(QueryDesc *queryDesc,
     173             :                      ScanDirection direction, uint64 count, bool execute_once);
     174             : extern void ExecutorFinish(QueryDesc *queryDesc);
     175             : extern void standard_ExecutorFinish(QueryDesc *queryDesc);
     176             : extern void ExecutorEnd(QueryDesc *queryDesc);
     177             : extern void standard_ExecutorEnd(QueryDesc *queryDesc);
     178             : extern void ExecutorRewind(QueryDesc *queryDesc);
     179             : extern bool ExecCheckRTPerms(List *rangeTable, bool ereport_on_violation);
     180             : extern void CheckValidResultRel(Relation resultRel, CmdType operation);
     181             : extern void InitResultRelInfo(ResultRelInfo *resultRelInfo,
     182             :                   Relation resultRelationDesc,
     183             :                   Index resultRelationIndex,
     184             :                   Relation partition_root,
     185             :                   int instrument_options);
     186             : extern ResultRelInfo *ExecGetTriggerResultRel(EState *estate, Oid relid);
     187             : extern void ExecCleanUpTriggerState(EState *estate);
     188             : extern bool ExecContextForcesOids(PlanState *planstate, bool *hasoids);
     189             : extern void ExecConstraints(ResultRelInfo *resultRelInfo,
     190             :                 TupleTableSlot *slot, EState *estate);
     191             : extern void ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo,
     192             :                      TupleTableSlot *slot, EState *estate);
     193             : extern LockTupleMode ExecUpdateLockMode(EState *estate, ResultRelInfo *relinfo);
     194             : extern ExecRowMark *ExecFindRowMark(EState *estate, Index rti, bool missing_ok);
     195             : extern ExecAuxRowMark *ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist);
     196             : extern TupleTableSlot *EvalPlanQual(EState *estate, EPQState *epqstate,
     197             :              Relation relation, Index rti, int lockmode,
     198             :              ItemPointer tid, TransactionId priorXmax);
     199             : extern HeapTuple EvalPlanQualFetch(EState *estate, Relation relation,
     200             :                   int lockmode, LockWaitPolicy wait_policy, ItemPointer tid,
     201             :                   TransactionId priorXmax);
     202             : extern void EvalPlanQualInit(EPQState *epqstate, EState *estate,
     203             :                  Plan *subplan, List *auxrowmarks, int epqParam);
     204             : extern void EvalPlanQualSetPlan(EPQState *epqstate,
     205             :                     Plan *subplan, List *auxrowmarks);
     206             : extern void EvalPlanQualSetTuple(EPQState *epqstate, Index rti,
     207             :                      HeapTuple tuple);
     208             : extern HeapTuple EvalPlanQualGetTuple(EPQState *epqstate, Index rti);
     209             : extern void ExecSetupPartitionTupleRouting(Relation rel,
     210             :                                Index resultRTindex,
     211             :                                EState *estate,
     212             :                                PartitionDispatch **pd,
     213             :                                ResultRelInfo **partitions,
     214             :                                TupleConversionMap ***tup_conv_maps,
     215             :                                TupleTableSlot **partition_tuple_slot,
     216             :                                int *num_parted, int *num_partitions);
     217             : extern int ExecFindPartition(ResultRelInfo *resultRelInfo,
     218             :                   PartitionDispatch *pd,
     219             :                   TupleTableSlot *slot,
     220             :                   EState *estate);
     221             : 
     222             : #define EvalPlanQualSetSlot(epqstate, slot)  ((epqstate)->origslot = (slot))
     223             : extern void EvalPlanQualFetchRowMarks(EPQState *epqstate);
     224             : extern TupleTableSlot *EvalPlanQualNext(EPQState *epqstate);
     225             : extern void EvalPlanQualBegin(EPQState *epqstate, EState *parentestate);
     226             : extern void EvalPlanQualEnd(EPQState *epqstate);
     227             : 
     228             : /*
     229             :  * functions in execProcnode.c
     230             :  */
     231             : extern PlanState *ExecInitNode(Plan *node, EState *estate, int eflags);
     232             : extern Node *MultiExecProcNode(PlanState *node);
     233             : extern void ExecEndNode(PlanState *node);
     234             : extern bool ExecShutdownNode(PlanState *node);
     235             : extern void ExecSetTupleBound(int64 tuples_needed, PlanState *child_node);
     236             : 
     237             : 
     238             : /* ----------------------------------------------------------------
     239             :  *      ExecProcNode
     240             :  *
     241             :  *      Execute the given node to return a(nother) tuple.
     242             :  * ----------------------------------------------------------------
     243             :  */
     244             : #ifndef FRONTEND
     245             : static inline TupleTableSlot *
     246    20545027 : ExecProcNode(PlanState *node)
     247             : {
     248    20545027 :     if (node->chgParam != NULL) /* something changed? */
     249        3552 :         ExecReScan(node);       /* let ReScan handle this */
     250             : 
     251    20545027 :     return node->ExecProcNode(node);
     252             : }
     253             : #endif
     254             : 
     255             : /*
     256             :  * prototypes from functions in execExpr.c
     257             :  */
     258             : extern ExprState *ExecInitExpr(Expr *node, PlanState *parent);
     259             : extern ExprState *ExecInitQual(List *qual, PlanState *parent);
     260             : extern ExprState *ExecInitCheck(List *qual, PlanState *parent);
     261             : extern List *ExecInitExprList(List *nodes, PlanState *parent);
     262             : extern ProjectionInfo *ExecBuildProjectionInfo(List *targetList,
     263             :                         ExprContext *econtext,
     264             :                         TupleTableSlot *slot,
     265             :                         PlanState *parent,
     266             :                         TupleDesc inputDesc);
     267             : extern ExprState *ExecPrepareExpr(Expr *node, EState *estate);
     268             : extern ExprState *ExecPrepareQual(List *qual, EState *estate);
     269             : extern ExprState *ExecPrepareCheck(List *qual, EState *estate);
     270             : extern List *ExecPrepareExprList(List *nodes, EState *estate);
     271             : 
     272             : /*
     273             :  * ExecEvalExpr
     274             :  *
     275             :  * Evaluate expression identified by "state" in the execution context
     276             :  * given by "econtext".  *isNull is set to the is-null flag for the result,
     277             :  * and the Datum value is the function result.
     278             :  *
     279             :  * The caller should already have switched into the temporary memory
     280             :  * context econtext->ecxt_per_tuple_memory.  The convenience entry point
     281             :  * ExecEvalExprSwitchContext() is provided for callers who don't prefer to
     282             :  * do the switch in an outer loop.
     283             :  */
     284             : #ifndef FRONTEND
     285             : static inline Datum
     286     1334773 : ExecEvalExpr(ExprState *state,
     287             :              ExprContext *econtext,
     288             :              bool *isNull)
     289             : {
     290     1334773 :     return (*state->evalfunc) (state, econtext, isNull);
     291             : }
     292             : #endif
     293             : 
     294             : /*
     295             :  * ExecEvalExprSwitchContext
     296             :  *
     297             :  * Same as ExecEvalExpr, but get into the right allocation context explicitly.
     298             :  */
     299             : #ifndef FRONTEND
     300             : static inline Datum
     301    22265792 : ExecEvalExprSwitchContext(ExprState *state,
     302             :                           ExprContext *econtext,
     303             :                           bool *isNull)
     304             : {
     305             :     Datum       retDatum;
     306             :     MemoryContext oldContext;
     307             : 
     308    22265792 :     oldContext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
     309    22265792 :     retDatum = (*state->evalfunc) (state, econtext, isNull);
     310    22262716 :     MemoryContextSwitchTo(oldContext);
     311    22262716 :     return retDatum;
     312             : }
     313             : #endif
     314             : 
     315             : /*
     316             :  * ExecProject
     317             :  *
     318             :  * Projects a tuple based on projection info and stores it in the slot passed
     319             :  * to ExecBuildProjectInfo().
     320             :  *
     321             :  * Note: the result is always a virtual tuple; therefore it may reference
     322             :  * the contents of the exprContext's scan tuples and/or temporary results
     323             :  * constructed in the exprContext.  If the caller wishes the result to be
     324             :  * valid longer than that data will be valid, he must call ExecMaterializeSlot
     325             :  * on the result slot.
     326             :  */
     327             : #ifndef FRONTEND
     328             : static inline TupleTableSlot *
     329    19951853 : ExecProject(ProjectionInfo *projInfo)
     330             : {
     331    19951853 :     ExprContext *econtext = projInfo->pi_exprContext;
     332    19951853 :     ExprState  *state = &projInfo->pi_state;
     333    19951853 :     TupleTableSlot *slot = state->resultslot;
     334             :     bool        isnull;
     335             : 
     336             :     /*
     337             :      * Clear any former contents of the result slot.  This makes it safe for
     338             :      * us to use the slot's Datum/isnull arrays as workspace.
     339             :      */
     340    19951853 :     ExecClearTuple(slot);
     341             : 
     342             :     /* Run the expression, discarding scalar result from the last column. */
     343    19951853 :     (void) ExecEvalExprSwitchContext(state, econtext, &isnull);
     344             : 
     345             :     /*
     346             :      * Successfully formed a result row.  Mark the result slot as containing a
     347             :      * valid virtual tuple (inlined version of ExecStoreVirtualTuple()).
     348             :      */
     349    19949028 :     slot->tts_isempty = false;
     350    19949028 :     slot->tts_nvalid = slot->tts_tupleDescriptor->natts;
     351             : 
     352    19949028 :     return slot;
     353             : }
     354             : #endif
     355             : 
     356             : /*
     357             :  * ExecQual - evaluate a qual prepared with ExecInitQual (possibly via
     358             :  * ExecPrepareQual).  Returns true if qual is satisfied, else false.
     359             :  *
     360             :  * Note: ExecQual used to have a third argument "resultForNull".  The
     361             :  * behavior of this function now corresponds to resultForNull == false.
     362             :  * If you want the resultForNull == true behavior, see ExecCheck.
     363             :  */
     364             : #ifndef FRONTEND
     365             : static inline bool
     366    10352715 : ExecQual(ExprState *state, ExprContext *econtext)
     367             : {
     368             :     Datum       ret;
     369             :     bool        isnull;
     370             : 
     371             :     /* short-circuit (here and in ExecInitQual) for empty restriction list */
     372    10352715 :     if (state == NULL)
     373     8163121 :         return true;
     374             : 
     375             :     /* verify that expression was compiled using ExecInitQual */
     376     2189594 :     Assert(state->flags & EEO_FLAG_IS_QUAL);
     377             : 
     378     2189594 :     ret = ExecEvalExprSwitchContext(state, econtext, &isnull);
     379             : 
     380             :     /* EEOP_QUAL should never return NULL */
     381     2189593 :     Assert(!isnull);
     382             : 
     383     2189593 :     return DatumGetBool(ret);
     384             : }
     385             : #endif
     386             : 
     387             : extern bool ExecCheck(ExprState *state, ExprContext *context);
     388             : 
     389             : /*
     390             :  * prototypes from functions in execSRF.c
     391             :  */
     392             : extern SetExprState *ExecInitTableFunctionResult(Expr *expr,
     393             :                             ExprContext *econtext, PlanState *parent);
     394             : extern Tuplestorestate *ExecMakeTableFunctionResult(SetExprState *setexpr,
     395             :                             ExprContext *econtext,
     396             :                             MemoryContext argContext,
     397             :                             TupleDesc expectedDesc,
     398             :                             bool randomAccess);
     399             : extern SetExprState *ExecInitFunctionResultSet(Expr *expr,
     400             :                           ExprContext *econtext, PlanState *parent);
     401             : extern Datum ExecMakeFunctionResultSet(SetExprState *fcache,
     402             :                           ExprContext *econtext,
     403             :                           bool *isNull,
     404             :                           ExprDoneCond *isDone);
     405             : 
     406             : /*
     407             :  * prototypes from functions in execScan.c
     408             :  */
     409             : typedef TupleTableSlot *(*ExecScanAccessMtd) (ScanState *node);
     410             : typedef bool (*ExecScanRecheckMtd) (ScanState *node, TupleTableSlot *slot);
     411             : 
     412             : extern TupleTableSlot *ExecScan(ScanState *node, ExecScanAccessMtd accessMtd,
     413             :          ExecScanRecheckMtd recheckMtd);
     414             : extern void ExecAssignScanProjectionInfo(ScanState *node);
     415             : extern void ExecAssignScanProjectionInfoWithVarno(ScanState *node, Index varno);
     416             : extern void ExecScanReScan(ScanState *node);
     417             : 
     418             : /*
     419             :  * prototypes from functions in execTuples.c
     420             :  */
     421             : extern void ExecInitResultTupleSlot(EState *estate, PlanState *planstate);
     422             : extern void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate);
     423             : extern TupleTableSlot *ExecInitExtraTupleSlot(EState *estate);
     424             : extern TupleTableSlot *ExecInitNullTupleSlot(EState *estate,
     425             :                       TupleDesc tupType);
     426             : extern TupleDesc ExecTypeFromTL(List *targetList, bool hasoid);
     427             : extern TupleDesc ExecCleanTypeFromTL(List *targetList, bool hasoid);
     428             : extern TupleDesc ExecTypeFromExprList(List *exprList);
     429             : extern void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList);
     430             : extern void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg);
     431             : 
     432             : typedef struct TupOutputState
     433             : {
     434             :     TupleTableSlot *slot;
     435             :     DestReceiver *dest;
     436             : } TupOutputState;
     437             : 
     438             : extern TupOutputState *begin_tup_output_tupdesc(DestReceiver *dest,
     439             :                          TupleDesc tupdesc);
     440             : extern void do_tup_output(TupOutputState *tstate, Datum *values, bool *isnull);
     441             : extern void do_text_output_multiline(TupOutputState *tstate, const char *txt);
     442             : extern void end_tup_output(TupOutputState *tstate);
     443             : 
     444             : /*
     445             :  * Write a single line of text given as a C string.
     446             :  *
     447             :  * Should only be used with a single-TEXT-attribute tupdesc.
     448             :  */
     449             : #define do_text_output_oneline(tstate, str_to_emit) \
     450             :     do { \
     451             :         Datum   values_[1]; \
     452             :         bool    isnull_[1]; \
     453             :         values_[0] = PointerGetDatum(cstring_to_text(str_to_emit)); \
     454             :         isnull_[0] = false; \
     455             :         do_tup_output(tstate, values_, isnull_); \
     456             :         pfree(DatumGetPointer(values_[0])); \
     457             :     } while (0)
     458             : 
     459             : 
     460             : /*
     461             :  * prototypes from functions in execUtils.c
     462             :  */
     463             : extern EState *CreateExecutorState(void);
     464             : extern void FreeExecutorState(EState *estate);
     465             : extern ExprContext *CreateExprContext(EState *estate);
     466             : extern ExprContext *CreateStandaloneExprContext(void);
     467             : extern void FreeExprContext(ExprContext *econtext, bool isCommit);
     468             : extern void ReScanExprContext(ExprContext *econtext);
     469             : 
     470             : #define ResetExprContext(econtext) \
     471             :     MemoryContextReset((econtext)->ecxt_per_tuple_memory)
     472             : 
     473             : extern ExprContext *MakePerTupleExprContext(EState *estate);
     474             : 
     475             : /* Get an EState's per-output-tuple exprcontext, making it if first use */
     476             : #define GetPerTupleExprContext(estate) \
     477             :     ((estate)->es_per_tuple_exprcontext ? \
     478             :      (estate)->es_per_tuple_exprcontext : \
     479             :      MakePerTupleExprContext(estate))
     480             : 
     481             : #define GetPerTupleMemoryContext(estate) \
     482             :     (GetPerTupleExprContext(estate)->ecxt_per_tuple_memory)
     483             : 
     484             : /* Reset an EState's per-output-tuple exprcontext, if one's been created */
     485             : #define ResetPerTupleExprContext(estate) \
     486             :     do { \
     487             :         if ((estate)->es_per_tuple_exprcontext) \
     488             :             ResetExprContext((estate)->es_per_tuple_exprcontext); \
     489             :     } while (0)
     490             : 
     491             : extern void ExecAssignExprContext(EState *estate, PlanState *planstate);
     492             : extern void ExecAssignResultType(PlanState *planstate, TupleDesc tupDesc);
     493             : extern void ExecAssignResultTypeFromTL(PlanState *planstate);
     494             : extern TupleDesc ExecGetResultType(PlanState *planstate);
     495             : extern void ExecAssignProjectionInfo(PlanState *planstate,
     496             :                          TupleDesc inputDesc);
     497             : extern void ExecFreeExprContext(PlanState *planstate);
     498             : extern void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc);
     499             : extern void ExecAssignScanTypeFromOuterPlan(ScanState *scanstate);
     500             : 
     501             : extern bool ExecRelationIsTargetRelation(EState *estate, Index scanrelid);
     502             : 
     503             : extern Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags);
     504             : extern void ExecCloseScanRelation(Relation scanrel);
     505             : 
     506             : extern int  executor_errposition(EState *estate, int location);
     507             : 
     508             : extern void RegisterExprContextCallback(ExprContext *econtext,
     509             :                             ExprContextCallbackFunction function,
     510             :                             Datum arg);
     511             : extern void UnregisterExprContextCallback(ExprContext *econtext,
     512             :                               ExprContextCallbackFunction function,
     513             :                               Datum arg);
     514             : 
     515             : extern void ExecLockNonLeafAppendTables(List *partitioned_rels, EState *estate);
     516             : 
     517             : extern Datum GetAttributeByName(HeapTupleHeader tuple, const char *attname,
     518             :                    bool *isNull);
     519             : extern Datum GetAttributeByNum(HeapTupleHeader tuple, AttrNumber attrno,
     520             :                   bool *isNull);
     521             : 
     522             : extern int  ExecTargetListLength(List *targetlist);
     523             : extern int  ExecCleanTargetListLength(List *targetlist);
     524             : 
     525             : /*
     526             :  * prototypes from functions in execIndexing.c
     527             :  */
     528             : extern void ExecOpenIndices(ResultRelInfo *resultRelInfo, bool speculative);
     529             : extern void ExecCloseIndices(ResultRelInfo *resultRelInfo);
     530             : extern List *ExecInsertIndexTuples(TupleTableSlot *slot, ItemPointer tupleid,
     531             :                       EState *estate, bool noDupErr, bool *specConflict,
     532             :                       List *arbiterIndexes);
     533             : extern bool ExecCheckIndexConstraints(TupleTableSlot *slot, EState *estate,
     534             :                           ItemPointer conflictTid, List *arbiterIndexes);
     535             : extern void check_exclusion_constraint(Relation heap, Relation index,
     536             :                            IndexInfo *indexInfo,
     537             :                            ItemPointer tupleid,
     538             :                            Datum *values, bool *isnull,
     539             :                            EState *estate, bool newIndex);
     540             : 
     541             : /*
     542             :  * prototypes from functions in execReplication.c
     543             :  */
     544             : extern bool RelationFindReplTupleByIndex(Relation rel, Oid idxoid,
     545             :                              LockTupleMode lockmode,
     546             :                              TupleTableSlot *searchslot,
     547             :                              TupleTableSlot *outslot);
     548             : extern bool RelationFindReplTupleSeq(Relation rel, LockTupleMode lockmode,
     549             :                          TupleTableSlot *searchslot, TupleTableSlot *outslot);
     550             : 
     551             : extern void ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot);
     552             : extern void ExecSimpleRelationUpdate(EState *estate, EPQState *epqstate,
     553             :                          TupleTableSlot *searchslot, TupleTableSlot *slot);
     554             : extern void ExecSimpleRelationDelete(EState *estate, EPQState *epqstate,
     555             :                          TupleTableSlot *searchslot);
     556             : extern void CheckCmdReplicaIdentity(Relation rel, CmdType cmd);
     557             : 
     558             : extern void CheckSubscriptionRelkind(char relkind, const char *nspname,
     559             :                          const char *relname);
     560             : 
     561             : #endif                          /* EXECUTOR_H  */

Generated by: LCOV version 1.11