codekingpro/portable-devtools
115k
1/*-------------------------------------------------------------------------2 *3 * execExpr.h4 * Low level infrastructure related to expression evaluation5 *6 *7 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group8 * Portions Copyright (c) 1994, Regents of the University of California9 *10 * src/include/executor/execExpr.h11 *12 *-------------------------------------------------------------------------13 */14#ifndef EXEC_EXPR_H15#define EXEC_EXPR_H16 17#include "executor/nodeAgg.h"18#include "nodes/execnodes.h"19 20/* forward references to avoid circularity */21struct ExprEvalStep;22struct SubscriptingRefState;23struct ScalarArrayOpExprHashTable;24struct JsonConstructorExprState;25 26/* Bits in ExprState->flags (see also execnodes.h for public flag bits): */27/* expression's interpreter has been initialized */28#define EEO_FLAG_INTERPRETER_INITIALIZED (1 << 1)29/* jump-threading is in use */30#define EEO_FLAG_DIRECT_THREADED (1 << 2)31 32/* Typical API for out-of-line evaluation subroutines */33typedef void (*ExecEvalSubroutine) (ExprState *state,34 struct ExprEvalStep *op,35 ExprContext *econtext);36 37/* API for out-of-line evaluation subroutines returning bool */38typedef bool (*ExecEvalBoolSubroutine) (ExprState *state,39 struct ExprEvalStep *op,40 ExprContext *econtext);41 42/* ExprEvalSteps that cache a composite type's tupdesc need one of these */43/* (it fits in-line in some step types, otherwise allocate out-of-line) */44typedef struct ExprEvalRowtypeCache45{46 /*47 * cacheptr points to composite type's TypeCacheEntry if tupdesc_id is not48 * 0; or for an anonymous RECORD type, it points directly at the cached49 * tupdesc for the type, and tupdesc_id is 0. (We'd use separate fields50 * if space were not at a premium.) Initial state is cacheptr == NULL.51 */52 void *cacheptr;53 uint64 tupdesc_id; /* last-seen tupdesc identifier, or 0 */54} ExprEvalRowtypeCache;55 56/*57 * Discriminator for ExprEvalSteps.58 *59 * Identifies the operation to be executed and which member in the60 * ExprEvalStep->d union is valid.61 *62 * The order of entries needs to be kept in sync with the dispatch_table[]63 * array in execExprInterp.c:ExecInterpExpr().64 */65typedef enum ExprEvalOp66{67 /* entire expression has been evaluated completely, return */68 EEOP_DONE,69 70 /* apply slot_getsomeattrs on corresponding tuple slot */71 EEOP_INNER_FETCHSOME,72 EEOP_OUTER_FETCHSOME,73 EEOP_SCAN_FETCHSOME,74 75 /* compute non-system Var value */76 EEOP_INNER_VAR,77 EEOP_OUTER_VAR,78 EEOP_SCAN_VAR,79 80 /* compute system Var value */81 EEOP_INNER_SYSVAR,82 EEOP_OUTER_SYSVAR,83 EEOP_SCAN_SYSVAR,84 85 /* compute wholerow Var */86 EEOP_WHOLEROW,87 88 /*89 * Compute non-system Var value, assign it into ExprState's resultslot.90 * These are not used if a CheckVarSlotCompatibility() check would be91 * needed.92 */93 EEOP_ASSIGN_INNER_VAR,94 EEOP_ASSIGN_OUTER_VAR,95 EEOP_ASSIGN_SCAN_VAR,96 97 /* assign ExprState's resvalue/resnull to a column of its resultslot */98 EEOP_ASSIGN_TMP,99 /* ditto, applying MakeExpandedObjectReadOnly() */100 EEOP_ASSIGN_TMP_MAKE_RO,101 102 /* evaluate Const value */103 EEOP_CONST,104 105 /*106 * Evaluate function call (including OpExprs etc). For speed, we107 * distinguish in the opcode whether the function is strict and/or108 * requires usage stats tracking.109 */110 EEOP_FUNCEXPR,111 EEOP_FUNCEXPR_STRICT,112 EEOP_FUNCEXPR_FUSAGE,113 EEOP_FUNCEXPR_STRICT_FUSAGE,114 115 /*116 * Evaluate boolean AND expression, one step per subexpression. FIRST/LAST117 * subexpressions are special-cased for performance. Since AND always has118 * at least two subexpressions, FIRST and LAST never apply to the same119 * subexpression.120 */121 EEOP_BOOL_AND_STEP_FIRST,122 EEOP_BOOL_AND_STEP,123 EEOP_BOOL_AND_STEP_LAST,124 125 /* similarly for boolean OR expression */126 EEOP_BOOL_OR_STEP_FIRST,127 EEOP_BOOL_OR_STEP,128 EEOP_BOOL_OR_STEP_LAST,129 130 /* evaluate boolean NOT expression */131 EEOP_BOOL_NOT_STEP,132 133 /* simplified version of BOOL_AND_STEP for use by ExecQual() */134 EEOP_QUAL,135 136 /* unconditional jump to another step */137 EEOP_JUMP,138 139 /* conditional jumps based on current result value */140 EEOP_JUMP_IF_NULL,141 EEOP_JUMP_IF_NOT_NULL,142 EEOP_JUMP_IF_NOT_TRUE,143 144 /* perform NULL tests for scalar values */145 EEOP_NULLTEST_ISNULL,146 EEOP_NULLTEST_ISNOTNULL,147 148 /* perform NULL tests for row values */149 EEOP_NULLTEST_ROWISNULL,150 EEOP_NULLTEST_ROWISNOTNULL,151 152 /* evaluate a BooleanTest expression */153 EEOP_BOOLTEST_IS_TRUE,154 EEOP_BOOLTEST_IS_NOT_TRUE,155 EEOP_BOOLTEST_IS_FALSE,156 EEOP_BOOLTEST_IS_NOT_FALSE,157 158 /* evaluate PARAM_EXEC/EXTERN parameters */159 EEOP_PARAM_EXEC,160 EEOP_PARAM_EXTERN,161 EEOP_PARAM_CALLBACK,162 163 /* return CaseTestExpr value */164 EEOP_CASE_TESTVAL,165 166 /* apply MakeExpandedObjectReadOnly() to target value */167 EEOP_MAKE_READONLY,168 169 /* evaluate assorted special-purpose expression types */170 EEOP_IOCOERCE,171 EEOP_DISTINCT,172 EEOP_NOT_DISTINCT,173 EEOP_NULLIF,174 EEOP_SQLVALUEFUNCTION,175 EEOP_CURRENTOFEXPR,176 EEOP_NEXTVALUEEXPR,177 EEOP_ARRAYEXPR,178 EEOP_ARRAYCOERCE,179 EEOP_ROW,180 181 /*182 * Compare two individual elements of each of two compared ROW()183 * expressions. Skip to ROWCOMPARE_FINAL if elements are not equal.184 */185 EEOP_ROWCOMPARE_STEP,186 187 /* evaluate boolean value based on previous ROWCOMPARE_STEP operations */188 EEOP_ROWCOMPARE_FINAL,189 190 /* evaluate GREATEST() or LEAST() */191 EEOP_MINMAX,192 193 /* evaluate FieldSelect expression */194 EEOP_FIELDSELECT,195 196 /*197 * Deform tuple before evaluating new values for individual fields in a198 * FieldStore expression.199 */200 EEOP_FIELDSTORE_DEFORM,201 202 /*203 * Form the new tuple for a FieldStore expression. Individual fields will204 * have been evaluated into columns of the tuple deformed by the preceding205 * DEFORM step.206 */207 EEOP_FIELDSTORE_FORM,208 209 /* Process container subscripts; possibly short-circuit result to NULL */210 EEOP_SBSREF_SUBSCRIPTS,211 212 /*213 * Compute old container element/slice when a SubscriptingRef assignment214 * expression contains SubscriptingRef/FieldStore subexpressions. Value is215 * accessed using the CaseTest mechanism.216 */217 EEOP_SBSREF_OLD,218 219 /* compute new value for SubscriptingRef assignment expression */220 EEOP_SBSREF_ASSIGN,221 222 /* compute element/slice for SubscriptingRef fetch expression */223 EEOP_SBSREF_FETCH,224 225 /* evaluate value for CoerceToDomainValue */226 EEOP_DOMAIN_TESTVAL,227 228 /* evaluate a domain's NOT NULL constraint */229 EEOP_DOMAIN_NOTNULL,230 231 /* evaluate a single domain CHECK constraint */232 EEOP_DOMAIN_CHECK,233 234 /* evaluate assorted special-purpose expression types */235 EEOP_CONVERT_ROWTYPE,236 EEOP_SCALARARRAYOP,237 EEOP_HASHED_SCALARARRAYOP,238 EEOP_XMLEXPR,239 EEOP_JSON_CONSTRUCTOR,240 EEOP_IS_JSON,241 EEOP_AGGREF,242 EEOP_GROUPING_FUNC,243 EEOP_WINDOW_FUNC,244 EEOP_SUBPLAN,245 246 /* aggregation related nodes */247 EEOP_AGG_STRICT_DESERIALIZE,248 EEOP_AGG_DESERIALIZE,249 EEOP_AGG_STRICT_INPUT_CHECK_ARGS,250 EEOP_AGG_STRICT_INPUT_CHECK_NULLS,251 EEOP_AGG_PLAIN_PERGROUP_NULLCHECK,252 EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYVAL,253 EEOP_AGG_PLAIN_TRANS_STRICT_BYVAL,254 EEOP_AGG_PLAIN_TRANS_BYVAL,255 EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYREF,256 EEOP_AGG_PLAIN_TRANS_STRICT_BYREF,257 EEOP_AGG_PLAIN_TRANS_BYREF,258 EEOP_AGG_PRESORTED_DISTINCT_SINGLE,259 EEOP_AGG_PRESORTED_DISTINCT_MULTI,260 EEOP_AGG_ORDERED_TRANS_DATUM,261 EEOP_AGG_ORDERED_TRANS_TUPLE,262 263 /* non-existent operation, used e.g. to check array lengths */264 EEOP_LAST265} ExprEvalOp;266 267 268typedef struct ExprEvalStep269{270 /*271 * Instruction to be executed. During instruction preparation this is an272 * enum ExprEvalOp, but later it can be changed to some other type, e.g. a273 * pointer for computed goto (that's why it's an intptr_t).274 */275 intptr_t opcode;276 277 /* where to store the result of this step */278 Datum *resvalue;279 bool *resnull;280 281 /*282 * Inline data for the operation. Inline data is faster to access, but283 * also bloats the size of all instructions. The union should be kept to284 * no more than 40 bytes on 64-bit systems (so that the entire struct is285 * no more than 64 bytes, a single cacheline on common systems).286 */287 union288 {289 /* for EEOP_INNER/OUTER/SCAN_FETCHSOME */290 struct291 {292 /* attribute number up to which to fetch (inclusive) */293 int last_var;294 /* will the type of slot be the same for every invocation */295 bool fixed;296 /* tuple descriptor, if known */297 TupleDesc known_desc;298 /* type of slot, can only be relied upon if fixed is set */299 const TupleTableSlotOps *kind;300 } fetch;301 302 /* for EEOP_INNER/OUTER/SCAN_[SYS]VAR[_FIRST] */303 struct304 {305 /* attnum is attr number - 1 for regular VAR ... */306 /* but it's just the normal (negative) attr number for SYSVAR */307 int attnum;308 Oid vartype; /* type OID of variable */309 } var;310 311 /* for EEOP_WHOLEROW */312 struct313 {314 Var *var; /* original Var node in plan tree */315 bool first; /* first time through, need to initialize? */316 bool slow; /* need runtime check for nulls? */317 TupleDesc tupdesc; /* descriptor for resulting tuples */318 JunkFilter *junkFilter; /* JunkFilter to remove resjunk cols */319 } wholerow;320 321 /* for EEOP_ASSIGN_*_VAR */322 struct323 {324 /* target index in ExprState->resultslot->tts_values/nulls */325 int resultnum;326 /* source attribute number - 1 */327 int attnum;328 } assign_var;329 330 /* for EEOP_ASSIGN_TMP[_MAKE_RO] */331 struct332 {333 /* target index in ExprState->resultslot->tts_values/nulls */334 int resultnum;335 } assign_tmp;336 337 /* for EEOP_CONST */338 struct339 {340 /* constant's value */341 Datum value;342 bool isnull;343 } constval;344 345 /* for EEOP_FUNCEXPR_* / NULLIF / DISTINCT */346 struct347 {348 FmgrInfo *finfo; /* function's lookup data */349 FunctionCallInfo fcinfo_data; /* arguments etc */350 /* faster to access without additional indirection: */351 PGFunction fn_addr; /* actual call address */352 int nargs; /* number of arguments */353 } func;354 355 /* for EEOP_BOOL_*_STEP */356 struct357 {358 bool *anynull; /* track if any input was NULL */359 int jumpdone; /* jump here if result determined */360 } boolexpr;361 362 /* for EEOP_QUAL */363 struct364 {365 int jumpdone; /* jump here on false or null */366 } qualexpr;367 368 /* for EEOP_JUMP[_CONDITION] */369 struct370 {371 int jumpdone; /* target instruction's index */372 } jump;373 374 /* for EEOP_NULLTEST_ROWIS[NOT]NULL */375 struct376 {377 /* cached descriptor for composite type - filled at runtime */378 ExprEvalRowtypeCache rowcache;379 } nulltest_row;380 381 /* for EEOP_PARAM_EXEC/EXTERN */382 struct383 {384 int paramid; /* numeric ID for parameter */385 Oid paramtype; /* OID of parameter's datatype */386 } param;387 388 /* for EEOP_PARAM_CALLBACK */389 struct390 {391 ExecEvalSubroutine paramfunc; /* add-on evaluation subroutine */392 void *paramarg; /* private data for same */393 int paramid; /* numeric ID for parameter */394 Oid paramtype; /* OID of parameter's datatype */395 } cparam;396 397 /* for EEOP_CASE_TESTVAL/DOMAIN_TESTVAL */398 struct399 {400 Datum *value; /* value to return */401 bool *isnull;402 } casetest;403 404 /* for EEOP_MAKE_READONLY */405 struct406 {407 Datum *value; /* value to coerce to read-only */408 bool *isnull;409 } make_readonly;410 411 /* for EEOP_IOCOERCE */412 struct413 {414 /* lookup and call info for source type's output function */415 FmgrInfo *finfo_out;416 FunctionCallInfo fcinfo_data_out;417 /* lookup and call info for result type's input function */418 FmgrInfo *finfo_in;419 FunctionCallInfo fcinfo_data_in;420 } iocoerce;421 422 /* for EEOP_SQLVALUEFUNCTION */423 struct424 {425 SQLValueFunction *svf;426 } sqlvaluefunction;427 428 /* for EEOP_NEXTVALUEEXPR */429 struct430 {431 Oid seqid;432 Oid seqtypid;433 } nextvalueexpr;434 435 /* for EEOP_ARRAYEXPR */436 struct437 {438 Datum *elemvalues; /* element values get stored here */439 bool *elemnulls;440 int nelems; /* length of the above arrays */441 Oid elemtype; /* array element type */442 int16 elemlength; /* typlen of the array element type */443 bool elembyval; /* is the element type pass-by-value? */444 char elemalign; /* typalign of the element type */445 bool multidims; /* is array expression multi-D? */446 } arrayexpr;447 448 /* for EEOP_ARRAYCOERCE */449 struct450 {451 ExprState *elemexprstate; /* null if no per-element work */452 Oid resultelemtype; /* element type of result array */453 struct ArrayMapState *amstate; /* workspace for array_map */454 } arraycoerce;455 456 /* for EEOP_ROW */457 struct458 {459 TupleDesc tupdesc; /* descriptor for result tuples */460 /* workspace for the values constituting the row: */461 Datum *elemvalues;462 bool *elemnulls;463 } row;464 465 /* for EEOP_ROWCOMPARE_STEP */466 struct467 {468 /* lookup and call data for column comparison function */469 FmgrInfo *finfo;470 FunctionCallInfo fcinfo_data;471 PGFunction fn_addr;472 /* target for comparison resulting in NULL */473 int jumpnull;474 /* target for comparison yielding inequality */475 int jumpdone;476 } rowcompare_step;477 478 /* for EEOP_ROWCOMPARE_FINAL */479 struct480 {481 RowCompareType rctype;482 } rowcompare_final;483 484 /* for EEOP_MINMAX */485 struct486 {487 /* workspace for argument values */488 Datum *values;489 bool *nulls;490 int nelems;491 /* is it GREATEST or LEAST? */492 MinMaxOp op;493 /* lookup and call data for comparison function */494 FmgrInfo *finfo;495 FunctionCallInfo fcinfo_data;496 } minmax;497 498 /* for EEOP_FIELDSELECT */499 struct500 {501 AttrNumber fieldnum; /* field number to extract */502 Oid resulttype; /* field's type */503 /* cached descriptor for composite type - filled at runtime */504 ExprEvalRowtypeCache rowcache;505 } fieldselect;506 507 /* for EEOP_FIELDSTORE_DEFORM / FIELDSTORE_FORM */508 struct509 {510 /* original expression node */511 FieldStore *fstore;512 513 /* cached descriptor for composite type - filled at runtime */514 /* note that a DEFORM and FORM pair share the same cache */515 ExprEvalRowtypeCache *rowcache;516 517 /* workspace for column values */518 Datum *values;519 bool *nulls;520 int ncolumns;521 } fieldstore;522 523 /* for EEOP_SBSREF_SUBSCRIPTS */524 struct525 {526 ExecEvalBoolSubroutine subscriptfunc; /* evaluation subroutine */527 /* too big to have inline */528 struct SubscriptingRefState *state;529 int jumpdone; /* jump here on null */530 } sbsref_subscript;531 532 /* for EEOP_SBSREF_OLD / ASSIGN / FETCH */533 struct534 {535 ExecEvalSubroutine subscriptfunc; /* evaluation subroutine */536 /* too big to have inline */537 struct SubscriptingRefState *state;538 } sbsref;539 540 /* for EEOP_DOMAIN_NOTNULL / DOMAIN_CHECK */541 struct542 {543 /* name of constraint */544 char *constraintname;545 /* where the result of a CHECK constraint will be stored */546 Datum *checkvalue;547 bool *checknull;548 /* OID of domain type */549 Oid resulttype;550 } domaincheck;551 552 /* for EEOP_CONVERT_ROWTYPE */553 struct554 {555 Oid inputtype; /* input composite type */556 Oid outputtype; /* output composite type */557 /* these three fields are filled at runtime: */558 ExprEvalRowtypeCache *incache; /* cache for input type */559 ExprEvalRowtypeCache *outcache; /* cache for output type */560 TupleConversionMap *map; /* column mapping */561 } convert_rowtype;562 563 /* for EEOP_SCALARARRAYOP */564 struct565 {566 /* element_type/typlen/typbyval/typalign are filled at runtime */567 Oid element_type; /* InvalidOid if not yet filled */568 bool useOr; /* use OR or AND semantics? */569 int16 typlen; /* array element type storage info */570 bool typbyval;571 char typalign;572 FmgrInfo *finfo; /* function's lookup data */573 FunctionCallInfo fcinfo_data; /* arguments etc */574 /* faster to access without additional indirection: */575 PGFunction fn_addr; /* actual call address */576 } scalararrayop;577 578 /* for EEOP_HASHED_SCALARARRAYOP */579 struct580 {581 bool has_nulls;582 bool inclause; /* true for IN and false for NOT IN */583 struct ScalarArrayOpExprHashTable *elements_tab;584 FmgrInfo *finfo; /* function's lookup data */585 FunctionCallInfo fcinfo_data; /* arguments etc */586 ScalarArrayOpExpr *saop;587 } hashedscalararrayop;588 589 /* for EEOP_XMLEXPR */590 struct591 {592 XmlExpr *xexpr; /* original expression node */593 /* workspace for evaluating named args, if any */594 Datum *named_argvalue;595 bool *named_argnull;596 /* workspace for evaluating unnamed args, if any */597 Datum *argvalue;598 bool *argnull;599 } xmlexpr;600 601 /* for EEOP_JSON_CONSTRUCTOR */602 struct603 {604 struct JsonConstructorExprState *jcstate;605 } json_constructor;606 607 /* for EEOP_AGGREF */608 struct609 {610 int aggno;611 } aggref;612 613 /* for EEOP_GROUPING_FUNC */614 struct615 {616 List *clauses; /* integer list of column numbers */617 } grouping_func;618 619 /* for EEOP_WINDOW_FUNC */620 struct621 {622 /* out-of-line state, modified by nodeWindowAgg.c */623 WindowFuncExprState *wfstate;624 } window_func;625 626 /* for EEOP_SUBPLAN */627 struct628 {629 /* out-of-line state, created by nodeSubplan.c */630 SubPlanState *sstate;631 } subplan;632 633 /* for EEOP_AGG_*DESERIALIZE */634 struct635 {636 FunctionCallInfo fcinfo_data;637 int jumpnull;638 } agg_deserialize;639 640 /* for EEOP_AGG_STRICT_INPUT_CHECK_NULLS / STRICT_INPUT_CHECK_ARGS */641 struct642 {643 /*644 * For EEOP_AGG_STRICT_INPUT_CHECK_ARGS args contains pointers to645 * the NullableDatums that need to be checked for NULLs.646 *647 * For EEOP_AGG_STRICT_INPUT_CHECK_NULLS nulls contains pointers648 * to booleans that need to be checked for NULLs.649 *650 * Both cases currently need to exist because sometimes the651 * to-be-checked nulls are in TupleTableSlot.isnull array, and652 * sometimes in FunctionCallInfoBaseData.args[i].isnull.653 */654 NullableDatum *args;655 bool *nulls;656 int nargs;657 int jumpnull;658 } agg_strict_input_check;659 660 /* for EEOP_AGG_PLAIN_PERGROUP_NULLCHECK */661 struct662 {663 int setoff;664 int jumpnull;665 } agg_plain_pergroup_nullcheck;666 667 /* for EEOP_AGG_PRESORTED_DISTINCT_{SINGLE,MULTI} */668 struct669 {670 AggStatePerTrans pertrans;671 ExprContext *aggcontext;672 int jumpdistinct;673 } agg_presorted_distinctcheck;674 675 /* for EEOP_AGG_PLAIN_TRANS_[INIT_][STRICT_]{BYVAL,BYREF} */676 /* for EEOP_AGG_ORDERED_TRANS_{DATUM,TUPLE} */677 struct678 {679 AggStatePerTrans pertrans;680 ExprContext *aggcontext;681 int setno;682 int transno;683 int setoff;684 } agg_trans;685 686 /* for EEOP_IS_JSON */687 struct688 {689 JsonIsPredicate *pred; /* original expression node */690 } is_json;691 692 } d;693} ExprEvalStep;694 695/* Enforce the size rule given in the comment above */696StaticAssertDecl(sizeof(ExprEvalStep) <= 64,697 "size of ExprEvalStep exceeds 64 bytes");698 699 700/* Non-inline data for container operations */701typedef struct SubscriptingRefState702{703 bool isassignment; /* is it assignment, or just fetch? */704 705 /* workspace for type-specific subscripting code */706 void *workspace;707 708 /* numupper and upperprovided[] are filled at expression compile time */709 /* at runtime, subscripts are computed in upperindex[]/upperindexnull[] */710 int numupper;711 bool *upperprovided; /* indicates if this position is supplied */712 Datum *upperindex;713 bool *upperindexnull;714 715 /* similarly for lower indexes, if any */716 int numlower;717 bool *lowerprovided;718 Datum *lowerindex;719 bool *lowerindexnull;720 721 /* for assignment, new value to assign is evaluated into here */722 Datum replacevalue;723 bool replacenull;724 725 /* if we have a nested assignment, sbs_fetch_old puts old value here */726 Datum prevvalue;727 bool prevnull;728} SubscriptingRefState;729 730/* Execution step methods used for SubscriptingRef */731typedef struct SubscriptExecSteps732{733 /* See nodes/subscripting.h for more detail about these */734 ExecEvalBoolSubroutine sbs_check_subscripts; /* process subscripts */735 ExecEvalSubroutine sbs_fetch; /* fetch an element */736 ExecEvalSubroutine sbs_assign; /* assign to an element */737 ExecEvalSubroutine sbs_fetch_old; /* fetch old value for assignment */738} SubscriptExecSteps;739 740/* EEOP_JSON_CONSTRUCTOR state, too big to inline */741typedef struct JsonConstructorExprState742{743 JsonConstructorExpr *constructor;744 Datum *arg_values;745 bool *arg_nulls;746 Oid *arg_types;747 struct748 {749 int category;750 Oid outfuncid;751 } *arg_type_cache; /* cache for datum_to_json[b]() */752 int nargs;753} JsonConstructorExprState;754 755 756/* functions in execExpr.c */757extern void ExprEvalPushStep(ExprState *es, const ExprEvalStep *s);758 759/* functions in execExprInterp.c */760extern void ExecReadyInterpretedExpr(ExprState *state);761extern ExprEvalOp ExecEvalStepOp(ExprState *state, ExprEvalStep *op);762 763extern Datum ExecInterpExprStillValid(ExprState *state, ExprContext *econtext, bool *isNull);764extern void CheckExprStillValid(ExprState *state, ExprContext *econtext);765 766/*767 * Non fast-path execution functions. These are externs instead of statics in768 * execExprInterp.c, because that allows them to be used by other methods of769 * expression evaluation, reducing code duplication.770 */771extern void ExecEvalFuncExprFusage(ExprState *state, ExprEvalStep *op,772 ExprContext *econtext);773extern void ExecEvalFuncExprStrictFusage(ExprState *state, ExprEvalStep *op,774 ExprContext *econtext);775extern void ExecEvalParamExec(ExprState *state, ExprEvalStep *op,776 ExprContext *econtext);777extern void ExecEvalParamExtern(ExprState *state, ExprEvalStep *op,778 ExprContext *econtext);779extern void ExecEvalSQLValueFunction(ExprState *state, ExprEvalStep *op);780extern void ExecEvalCurrentOfExpr(ExprState *state, ExprEvalStep *op);781extern void ExecEvalNextValueExpr(ExprState *state, ExprEvalStep *op);782extern void ExecEvalRowNull(ExprState *state, ExprEvalStep *op,783 ExprContext *econtext);784extern void ExecEvalRowNotNull(ExprState *state, ExprEvalStep *op,785 ExprContext *econtext);786extern void ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op);787extern void ExecEvalArrayCoerce(ExprState *state, ExprEvalStep *op,788 ExprContext *econtext);789extern void ExecEvalRow(ExprState *state, ExprEvalStep *op);790extern void ExecEvalMinMax(ExprState *state, ExprEvalStep *op);791extern void ExecEvalFieldSelect(ExprState *state, ExprEvalStep *op,792 ExprContext *econtext);793extern void ExecEvalFieldStoreDeForm(ExprState *state, ExprEvalStep *op,794 ExprContext *econtext);795extern void ExecEvalFieldStoreForm(ExprState *state, ExprEvalStep *op,796 ExprContext *econtext);797extern void ExecEvalConvertRowtype(ExprState *state, ExprEvalStep *op,798 ExprContext *econtext);799extern void ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op);800extern void ExecEvalHashedScalarArrayOp(ExprState *state, ExprEvalStep *op,801 ExprContext *econtext);802extern void ExecEvalConstraintNotNull(ExprState *state, ExprEvalStep *op);803extern void ExecEvalConstraintCheck(ExprState *state, ExprEvalStep *op);804extern void ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op);805extern void ExecEvalJsonConstructor(ExprState *state, ExprEvalStep *op,806 ExprContext *econtext);807extern void ExecEvalJsonIsPredicate(ExprState *state, ExprEvalStep *op);808extern void ExecEvalGroupingFunc(ExprState *state, ExprEvalStep *op);809extern void ExecEvalSubPlan(ExprState *state, ExprEvalStep *op,810 ExprContext *econtext);811extern void ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op,812 ExprContext *econtext);813extern void ExecEvalSysVar(ExprState *state, ExprEvalStep *op,814 ExprContext *econtext, TupleTableSlot *slot);815 816extern void ExecAggInitGroup(AggState *aggstate, AggStatePerTrans pertrans, AggStatePerGroup pergroup,817 ExprContext *aggcontext);818extern Datum ExecAggCopyTransValue(AggState *aggstate, AggStatePerTrans pertrans,819 Datum newValue, bool newValueIsNull,820 Datum oldValue, bool oldValueIsNull);821extern bool ExecEvalPreOrderedDistinctSingle(AggState *aggstate,822 AggStatePerTrans pertrans);823extern bool ExecEvalPreOrderedDistinctMulti(AggState *aggstate,824 AggStatePerTrans pertrans);825extern void ExecEvalAggOrderedTransDatum(ExprState *state, ExprEvalStep *op,826 ExprContext *econtext);827extern void ExecEvalAggOrderedTransTuple(ExprState *state, ExprEvalStep *op,828 ExprContext *econtext);829 830#endif /* EXEC_EXPR_H */831 