execnodes.h
来自「PostgreSQL 8.2中增加了很多企业用户所需要的功能和性能上的提高,其开」· C头文件 代码 · 共 1,396 行 · 第 1/4 页
H
1,396 行
/* es_rowMarks is a list of these structs: */typedef struct ExecRowMark{ Relation relation; /* opened and RowShareLock'd relation */ Index rti; /* its range table index */ bool forUpdate; /* true = FOR UPDATE, false = FOR SHARE */ bool noWait; /* NOWAIT option */ char resname[32]; /* name for its ctid junk attribute */} ExecRowMark;/* ---------------------------------------------------------------- * Tuple Hash Tables * * All-in-memory tuple hash tables are used for a number of purposes. * ---------------------------------------------------------------- */typedef struct TupleHashEntryData *TupleHashEntry;typedef struct TupleHashTableData *TupleHashTable;typedef struct TupleHashEntryData{ /* firstTuple must be the first field in this struct! */ MinimalTuple firstTuple; /* copy of first tuple in this group */ /* there may be additional data beyond the end of this struct */} TupleHashEntryData; /* VARIABLE LENGTH STRUCT */typedef struct TupleHashTableData{ HTAB *hashtab; /* underlying dynahash table */ int numCols; /* number of columns in lookup key */ AttrNumber *keyColIdx; /* attr numbers of key columns */ FmgrInfo *eqfunctions; /* lookup data for comparison functions */ FmgrInfo *hashfunctions; /* lookup data for hash functions */ MemoryContext tablecxt; /* memory context containing table */ MemoryContext tempcxt; /* context for function evaluations */ Size entrysize; /* actual size to make each hash entry */ TupleTableSlot *tableslot; /* slot for referencing table entries */ TupleTableSlot *inputslot; /* current input tuple's slot */} TupleHashTableData;typedef HASH_SEQ_STATUS TupleHashIterator;/* * Use InitTupleHashIterator/TermTupleHashIterator for a read/write scan. * Use ResetTupleHashIterator if the table can be frozen (in this case no * explicit scan termination is needed). */#define InitTupleHashIterator(htable, iter) \ hash_seq_init(iter, (htable)->hashtab)#define TermTupleHashIterator(iter) \ hash_seq_term(iter)#define ResetTupleHashIterator(htable, iter) \ do { \ hash_freeze((htable)->hashtab); \ hash_seq_init(iter, (htable)->hashtab); \ } while (0)#define ScanTupleHashTable(iter) \ ((TupleHashEntry) hash_seq_search(iter))/* ---------------------------------------------------------------- * Expression State Trees * * Each executable expression tree has a parallel ExprState tree. * * Unlike PlanState, there is not an exact one-for-one correspondence between * ExprState node types and Expr node types. Many Expr node types have no * need for node-type-specific run-time state, and so they can use plain * ExprState or GenericExprState as their associated ExprState node type. * ---------------------------------------------------------------- *//* ---------------- * ExprState node * * ExprState is the common superclass for all ExprState-type nodes. * * It can also be instantiated directly for leaf Expr nodes that need no * local run-time state (such as Var, Const, or Param). * * To save on dispatch overhead, each ExprState node contains a function * pointer to the routine to execute to evaluate the node. * ---------------- */typedef struct ExprState ExprState;typedef Datum (*ExprStateEvalFunc) (ExprState *expression, ExprContext *econtext, bool *isNull, ExprDoneCond *isDone);struct ExprState{ NodeTag type; Expr *expr; /* associated Expr node */ ExprStateEvalFunc evalfunc; /* routine to run to execute node */};/* ---------------- * GenericExprState node * * This is used for Expr node types that need no local run-time state, * but have one child Expr node. * ---------------- */typedef struct GenericExprState{ ExprState xprstate; ExprState *arg; /* state of my child node */} GenericExprState;/* ---------------- * AggrefExprState node * ---------------- */typedef struct AggrefExprState{ ExprState xprstate; List *args; /* states of argument expressions */ int aggno; /* ID number for agg within its plan node */} AggrefExprState;/* ---------------- * ArrayRefExprState node * * Note: array types can be fixed-length (typlen > 0), but only when the * element type is itself fixed-length. Otherwise they are varlena structures * and have typlen = -1. In any case, an array type is never pass-by-value. * ---------------- */typedef struct ArrayRefExprState{ ExprState xprstate; List *refupperindexpr; /* states for child nodes */ List *reflowerindexpr; ExprState *refexpr; ExprState *refassgnexpr; int16 refattrlength; /* typlen of array type */ int16 refelemlength; /* typlen of the array element type */ bool refelembyval; /* is the element type pass-by-value? */ char refelemalign; /* typalign of the element type */} ArrayRefExprState;/* ---------------- * FuncExprState node * * Although named for FuncExpr, this is also used for OpExpr, DistinctExpr, * and NullIf nodes; be careful to check what xprstate.expr is actually * pointing at! * ---------------- */typedef struct FuncExprState{ ExprState xprstate; List *args; /* states of argument expressions */ /* * Function manager's lookup info for the target function. If func.fn_oid * is InvalidOid, we haven't initialized it yet. */ FmgrInfo func; /* * We also need to store argument values across calls when evaluating a * function-returning-set. * * setArgsValid is true when we are evaluating a set-valued function and * we are in the middle of a call series; we want to pass the same * argument values to the function again (and again, until it returns * ExprEndResult). */ bool setArgsValid; /* * Flag to remember whether we found a set-valued argument to the * function. This causes the function result to be a set as well. Valid * only when setArgsValid is true. */ bool setHasSetArg; /* some argument returns a set */ /* * Flag to remember whether we have registered a shutdown callback for * this FuncExprState. We do so only if setArgsValid has been true at * least once (since all the callback is for is to clear setArgsValid). */ bool shutdown_reg; /* a shutdown callback is registered */ /* * Current argument data for a set-valued function; contains valid data * only if setArgsValid is true. */ FunctionCallInfoData setArgs;} FuncExprState;/* ---------------- * ScalarArrayOpExprState node * * This is a FuncExprState plus some additional data. * ---------------- */typedef struct ScalarArrayOpExprState{ FuncExprState fxprstate; /* Cached info about array element type */ Oid element_type; int16 typlen; bool typbyval; char typalign;} ScalarArrayOpExprState;/* ---------------- * BoolExprState node * ---------------- */typedef struct BoolExprState{ ExprState xprstate; List *args; /* states of argument expression(s) */} BoolExprState;/* ---------------- * SubPlanState node * ---------------- */typedef struct SubPlanState{ ExprState xprstate; EState *sub_estate; /* subselect plan has its own EState */ struct PlanState *planstate; /* subselect plan's state tree */ ExprState *testexpr; /* state of combining expression */ List *args; /* states of argument expression(s) */ bool needShutdown; /* TRUE = need to shutdown subplan */ HeapTuple curTuple; /* copy of most recent tuple from subplan */ /* these are used when hashing the subselect's output: */ ProjectionInfo *projLeft; /* for projecting lefthand exprs */ ProjectionInfo *projRight; /* for projecting subselect output */ TupleHashTable hashtable; /* hash table for no-nulls subselect rows */ TupleHashTable hashnulls; /* hash table for rows with null(s) */ bool havehashrows; /* TRUE if hashtable is not empty */ bool havenullrows; /* TRUE if hashnulls is not empty */ MemoryContext tablecxt; /* memory context containing tables */ ExprContext *innerecontext; /* working context for comparisons */ AttrNumber *keyColIdx; /* control data for hash tables */ FmgrInfo *eqfunctions; /* comparison functions for hash tables */ FmgrInfo *hashfunctions; /* lookup data for hash functions */} SubPlanState;/* ---------------- * FieldSelectState node * ---------------- */typedef struct FieldSelectState{ ExprState xprstate; ExprState *arg; /* input expression */ TupleDesc argdesc; /* tupdesc for most recent input */} FieldSelectState;/* ---------------- * FieldStoreState node * ---------------- */typedef struct FieldStoreState{ ExprState xprstate; ExprState *arg; /* input tuple value */ List *newvals; /* new value(s) for field(s) */ TupleDesc argdesc; /* tupdesc for most recent input */} FieldStoreState;/* ---------------- * ConvertRowtypeExprState node * ---------------- */typedef struct ConvertRowtypeExprState{ ExprState xprstate; ExprState *arg; /* input tuple value */ TupleDesc indesc; /* tupdesc for source rowtype */ TupleDesc outdesc; /* tupdesc for result rowtype */ AttrNumber *attrMap; /* indexes of input fields, or 0 for null */ Datum *invalues; /* workspace for deconstructing source */ bool *inisnull; Datum *outvalues; /* workspace for constructing result */ bool *outisnull;} ConvertRowtypeExprState;/* ---------------- * CaseExprState node * ---------------- */typedef struct CaseExprState{ ExprState xprstate; ExprState *arg; /* implicit equality comparison argument */ List *args; /* the arguments (list of WHEN clauses) */ ExprState *defresult; /* the default result (ELSE clause) */} CaseExprState;/* ---------------- * CaseWhenState node * ---------------- */typedef struct CaseWhenState{ ExprState xprstate; ExprState *expr; /* condition expression */ ExprState *result; /* substitution result */} CaseWhenState;/* ---------------- * ArrayExprState node * * Note: ARRAY[] expressions always produce varlena arrays, never fixed-length * arrays. * ---------------- */typedef struct ArrayExprState{ ExprState xprstate; List *elements; /* states for child nodes */ int16 elemlength; /* typlen of the array element type */ bool elembyval; /* is the element type pass-by-value? */ char elemalign; /* typalign of the element type */} ArrayExprState;/* ---------------- * RowExprState node * ---------------- */typedef struct RowExprState{ ExprState xprstate; List *args; /* the arguments */ TupleDesc tupdesc; /* descriptor for result tuples */} RowExprState;/* ---------------- * RowCompareExprState node * ---------------- */typedef struct RowCompareExprState{ ExprState xprstate; List *largs; /* the left-hand input arguments */ List *rargs; /* the right-hand input arguments */ FmgrInfo *funcs; /* array of comparison function info */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?