PostgreSQL Source Code  git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
execExpr.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * execExpr.h
4  * Low level infrastructure related to expression evaluation
5  *
6  *
7  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/executor/execExpr.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef EXEC_EXPR_H
15 #define EXEC_EXPR_H
16 
17 #include "executor/nodeAgg.h"
18 #include "nodes/execnodes.h"
19 #include "nodes/miscnodes.h"
20 
21 /* forward references to avoid circularity */
22 struct ExprEvalStep;
26 
27 /* Bits in ExprState->flags (see also execnodes.h for public flag bits): */
28 /* expression's interpreter has been initialized */
29 #define EEO_FLAG_INTERPRETER_INITIALIZED (1 << 1)
30 /* jump-threading is in use */
31 #define EEO_FLAG_DIRECT_THREADED (1 << 2)
32 
33 /* Typical API for out-of-line evaluation subroutines */
35  struct ExprEvalStep *op,
36  ExprContext *econtext);
37 
38 /* API for out-of-line evaluation subroutines returning bool */
40  struct ExprEvalStep *op,
41  ExprContext *econtext);
42 
43 /* ExprEvalSteps that cache a composite type's tupdesc need one of these */
44 /* (it fits in-line in some step types, otherwise allocate out-of-line) */
45 typedef struct ExprEvalRowtypeCache
46 {
47  /*
48  * cacheptr points to composite type's TypeCacheEntry if tupdesc_id is not
49  * 0; or for an anonymous RECORD type, it points directly at the cached
50  * tupdesc for the type, and tupdesc_id is 0. (We'd use separate fields
51  * if space were not at a premium.) Initial state is cacheptr == NULL.
52  */
53  void *cacheptr;
54  uint64 tupdesc_id; /* last-seen tupdesc identifier, or 0 */
56 
57 /*
58  * Discriminator for ExprEvalSteps.
59  *
60  * Identifies the operation to be executed and which member in the
61  * ExprEvalStep->d union is valid.
62  *
63  * The order of entries needs to be kept in sync with the dispatch_table[]
64  * array in execExprInterp.c:ExecInterpExpr().
65  */
66 typedef enum ExprEvalOp
67 {
68  /* entire expression has been evaluated completely, return */
70 
71  /* apply slot_getsomeattrs on corresponding tuple slot */
75 
76  /* compute non-system Var value */
80 
81  /* compute system Var value */
85 
86  /* compute wholerow Var */
88 
89  /*
90  * Compute non-system Var value, assign it into ExprState's resultslot.
91  * These are not used if a CheckVarSlotCompatibility() check would be
92  * needed.
93  */
97 
98  /* assign ExprState's resvalue/resnull to a column of its resultslot */
100  /* ditto, applying MakeExpandedObjectReadOnly() */
102 
103  /* evaluate Const value */
105 
106  /*
107  * Evaluate function call (including OpExprs etc). For speed, we
108  * distinguish in the opcode whether the function is strict and/or
109  * requires usage stats tracking.
110  */
115 
116  /*
117  * Evaluate boolean AND expression, one step per subexpression. FIRST/LAST
118  * subexpressions are special-cased for performance. Since AND always has
119  * at least two subexpressions, FIRST and LAST never apply to the same
120  * subexpression.
121  */
125 
126  /* similarly for boolean OR expression */
130 
131  /* evaluate boolean NOT expression */
133 
134  /* simplified version of BOOL_AND_STEP for use by ExecQual() */
136 
137  /* unconditional jump to another step */
139 
140  /* conditional jumps based on current result value */
144 
145  /* perform NULL tests for scalar values */
148 
149  /* perform NULL tests for row values */
152 
153  /* evaluate a BooleanTest expression */
158 
159  /* evaluate PARAM_EXEC/EXTERN parameters */
163  /* set PARAM_EXEC value */
165 
166  /* return CaseTestExpr value */
168 
169  /* apply MakeExpandedObjectReadOnly() to target value */
171 
172  /* evaluate assorted special-purpose expression types */
184 
185  /*
186  * Compare two individual elements of each of two compared ROW()
187  * expressions. Skip to ROWCOMPARE_FINAL if elements are not equal.
188  */
190 
191  /* evaluate boolean value based on previous ROWCOMPARE_STEP operations */
193 
194  /* evaluate GREATEST() or LEAST() */
196 
197  /* evaluate FieldSelect expression */
199 
200  /*
201  * Deform tuple before evaluating new values for individual fields in a
202  * FieldStore expression.
203  */
205 
206  /*
207  * Form the new tuple for a FieldStore expression. Individual fields will
208  * have been evaluated into columns of the tuple deformed by the preceding
209  * DEFORM step.
210  */
212 
213  /* Process container subscripts; possibly short-circuit result to NULL */
215 
216  /*
217  * Compute old container element/slice when a SubscriptingRef assignment
218  * expression contains SubscriptingRef/FieldStore subexpressions. Value is
219  * accessed using the CaseTest mechanism.
220  */
222 
223  /* compute new value for SubscriptingRef assignment expression */
225 
226  /* compute element/slice for SubscriptingRef fetch expression */
228 
229  /* evaluate value for CoerceToDomainValue */
231 
232  /* evaluate a domain's NOT NULL constraint */
234 
235  /* evaluate a single domain CHECK constraint */
237 
238  /* evaluation steps for hashing */
244 
245  /* evaluate assorted special-purpose expression types */
260 
261  /* aggregation related nodes */
277 
278  /* non-existent operation, used e.g. to check array lengths */
279  EEOP_LAST
281 
282 
283 typedef struct ExprEvalStep
284 {
285  /*
286  * Instruction to be executed. During instruction preparation this is an
287  * enum ExprEvalOp, but later it can be changed to some other type, e.g. a
288  * pointer for computed goto (that's why it's an intptr_t).
289  */
290  intptr_t opcode;
291 
292  /* where to store the result of this step */
294  bool *resnull;
295 
296  /*
297  * Inline data for the operation. Inline data is faster to access, but
298  * also bloats the size of all instructions. The union should be kept to
299  * no more than 40 bytes on 64-bit systems (so that the entire struct is
300  * no more than 64 bytes, a single cacheline on common systems).
301  */
302  union
303  {
304  /* for EEOP_INNER/OUTER/SCAN_FETCHSOME */
305  struct
306  {
307  /* attribute number up to which to fetch (inclusive) */
308  int last_var;
309  /* will the type of slot be the same for every invocation */
310  bool fixed;
311  /* tuple descriptor, if known */
313  /* type of slot, can only be relied upon if fixed is set */
315  } fetch;
316 
317  /* for EEOP_INNER/OUTER/SCAN_[SYS]VAR[_FIRST] */
318  struct
319  {
320  /* attnum is attr number - 1 for regular VAR ... */
321  /* but it's just the normal (negative) attr number for SYSVAR */
322  int attnum;
323  Oid vartype; /* type OID of variable */
324  } var;
325 
326  /* for EEOP_WHOLEROW */
327  struct
328  {
329  Var *var; /* original Var node in plan tree */
330  bool first; /* first time through, need to initialize? */
331  bool slow; /* need runtime check for nulls? */
332  TupleDesc tupdesc; /* descriptor for resulting tuples */
333  JunkFilter *junkFilter; /* JunkFilter to remove resjunk cols */
335 
336  /* for EEOP_ASSIGN_*_VAR */
337  struct
338  {
339  /* target index in ExprState->resultslot->tts_values/nulls */
341  /* source attribute number - 1 */
342  int attnum;
344 
345  /* for EEOP_ASSIGN_TMP[_MAKE_RO] */
346  struct
347  {
348  /* target index in ExprState->resultslot->tts_values/nulls */
349  int resultnum;
351 
352  /* for EEOP_CONST */
353  struct
354  {
355  /* constant's value */
357  bool isnull;
359 
360  /* for EEOP_FUNCEXPR_* / NULLIF / DISTINCT */
361  struct
362  {
363  FmgrInfo *finfo; /* function's lookup data */
364  FunctionCallInfo fcinfo_data; /* arguments etc */
365  /* faster to access without additional indirection: */
366  PGFunction fn_addr; /* actual call address */
367  int nargs; /* number of arguments */
368  bool make_ro; /* make arg0 R/O (used only for NULLIF) */
369  } func;
370 
371  /* for EEOP_BOOL_*_STEP */
372  struct
373  {
374  bool *anynull; /* track if any input was NULL */
375  int jumpdone; /* jump here if result determined */
377 
378  /* for EEOP_QUAL */
379  struct
380  {
381  int jumpdone; /* jump here on false or null */
383 
384  /* for EEOP_JUMP[_CONDITION] */
385  struct
386  {
387  int jumpdone; /* target instruction's index */
388  } jump;
389 
390  /* for EEOP_NULLTEST_ROWIS[NOT]NULL */
391  struct
392  {
393  /* cached descriptor for composite type - filled at runtime */
396 
397  /* for EEOP_PARAM_EXEC/EXTERN and EEOP_PARAM_SET */
398  struct
399  {
400  int paramid; /* numeric ID for parameter */
401  Oid paramtype; /* OID of parameter's datatype */
402  } param;
403 
404  /* for EEOP_PARAM_CALLBACK */
405  struct
406  {
407  ExecEvalSubroutine paramfunc; /* add-on evaluation subroutine */
408  void *paramarg; /* private data for same */
409  int paramid; /* numeric ID for parameter */
410  Oid paramtype; /* OID of parameter's datatype */
412 
413  /* for EEOP_CASE_TESTVAL/DOMAIN_TESTVAL */
414  struct
415  {
416  Datum *value; /* value to return */
417  bool *isnull;
419 
420  /* for EEOP_MAKE_READONLY */
421  struct
422  {
423  Datum *value; /* value to coerce to read-only */
424  bool *isnull;
426 
427  /* for EEOP_IOCOERCE */
428  struct
429  {
430  /* lookup and call info for source type's output function */
433  /* lookup and call info for result type's input function */
437 
438  /* for EEOP_SQLVALUEFUNCTION */
439  struct
440  {
443 
444  /* for EEOP_NEXTVALUEEXPR */
445  struct
446  {
450 
451  /* for EEOP_ARRAYEXPR */
452  struct
453  {
454  Datum *elemvalues; /* element values get stored here */
455  bool *elemnulls;
456  int nelems; /* length of the above arrays */
457  Oid elemtype; /* array element type */
458  int16 elemlength; /* typlen of the array element type */
459  bool elembyval; /* is the element type pass-by-value? */
460  char elemalign; /* typalign of the element type */
461  bool multidims; /* is array expression multi-D? */
463 
464  /* for EEOP_ARRAYCOERCE */
465  struct
466  {
467  ExprState *elemexprstate; /* null if no per-element work */
468  Oid resultelemtype; /* element type of result array */
469  struct ArrayMapState *amstate; /* workspace for array_map */
471 
472  /* for EEOP_ROW */
473  struct
474  {
475  TupleDesc tupdesc; /* descriptor for result tuples */
476  /* workspace for the values constituting the row: */
477  Datum *elemvalues;
478  bool *elemnulls;
479  } row;
480 
481  /* for EEOP_ROWCOMPARE_STEP */
482  struct
483  {
484  /* lookup and call data for column comparison function */
485  FmgrInfo *finfo;
488  /* target for comparison resulting in NULL */
489  int jumpnull;
490  /* target for comparison yielding inequality */
491  int jumpdone;
493 
494  /* for EEOP_ROWCOMPARE_FINAL */
495  struct
496  {
499 
500  /* for EEOP_MINMAX */
501  struct
502  {
503  /* workspace for argument values */
505  bool *nulls;
506  int nelems;
507  /* is it GREATEST or LEAST? */
509  /* lookup and call data for comparison function */
510  FmgrInfo *finfo;
513 
514  /* for EEOP_FIELDSELECT */
515  struct
516  {
517  AttrNumber fieldnum; /* field number to extract */
518  Oid resulttype; /* field's type */
519  /* cached descriptor for composite type - filled at runtime */
522 
523  /* for EEOP_FIELDSTORE_DEFORM / FIELDSTORE_FORM */
524  struct
525  {
526  /* original expression node */
528 
529  /* cached descriptor for composite type - filled at runtime */
530  /* note that a DEFORM and FORM pair share the same cache */
532 
533  /* workspace for column values */
534  Datum *values;
535  bool *nulls;
536  int ncolumns;
538 
539  /* for EEOP_SBSREF_SUBSCRIPTS */
540  struct
541  {
542  ExecEvalBoolSubroutine subscriptfunc; /* evaluation subroutine */
543  /* too big to have inline */
545  int jumpdone; /* jump here on null */
547 
548  /* for EEOP_SBSREF_OLD / ASSIGN / FETCH */
549  struct
550  {
551  ExecEvalSubroutine subscriptfunc; /* evaluation subroutine */
552  /* too big to have inline */
553  struct SubscriptingRefState *state;
555 
556  /* for EEOP_DOMAIN_NOTNULL / DOMAIN_CHECK */
557  struct
558  {
559  /* name of constraint */
561  /* where the result of a CHECK constraint will be stored */
563  bool *checknull;
564  /* OID of domain type */
565  Oid resulttype;
568 
569  /* for EEOP_HASH_SET_INITVAL */
570  struct
571  {
573 
575 
576  /* for EEOP_HASHDATUM_(FIRST|NEXT32)[_STRICT] */
577  struct
578  {
579  FmgrInfo *finfo; /* function's lookup data */
580  FunctionCallInfo fcinfo_data; /* arguments etc */
581  /* faster to access without additional indirection: */
582  PGFunction fn_addr; /* actual call address */
583  int jumpdone; /* jump here on null */
584  NullableDatum *iresult; /* intermediate hash result */
586 
587  /* for EEOP_CONVERT_ROWTYPE */
588  struct
589  {
590  Oid inputtype; /* input composite type */
591  Oid outputtype; /* output composite type */
592  /* these three fields are filled at runtime: */
593  ExprEvalRowtypeCache *incache; /* cache for input type */
594  ExprEvalRowtypeCache *outcache; /* cache for output type */
595  TupleConversionMap *map; /* column mapping */
597 
598  /* for EEOP_SCALARARRAYOP */
599  struct
600  {
601  /* element_type/typlen/typbyval/typalign are filled at runtime */
602  Oid element_type; /* InvalidOid if not yet filled */
603  bool useOr; /* use OR or AND semantics? */
604  int16 typlen; /* array element type storage info */
605  bool typbyval;
606  char typalign;
607  FmgrInfo *finfo; /* function's lookup data */
608  FunctionCallInfo fcinfo_data; /* arguments etc */
609  /* faster to access without additional indirection: */
610  PGFunction fn_addr; /* actual call address */
612 
613  /* for EEOP_HASHED_SCALARARRAYOP */
614  struct
615  {
616  bool has_nulls;
617  bool inclause; /* true for IN and false for NOT IN */
619  FmgrInfo *finfo; /* function's lookup data */
620  FunctionCallInfo fcinfo_data; /* arguments etc */
623 
624  /* for EEOP_XMLEXPR */
625  struct
626  {
627  XmlExpr *xexpr; /* original expression node */
628  /* workspace for evaluating named args, if any */
631  /* workspace for evaluating unnamed args, if any */
633  bool *argnull;
635 
636  /* for EEOP_JSON_CONSTRUCTOR */
637  struct
638  {
641 
642  /* for EEOP_AGGREF */
643  struct
644  {
645  int aggno;
647 
648  /* for EEOP_GROUPING_FUNC */
649  struct
650  {
651  List *clauses; /* integer list of column numbers */
653 
654  /* for EEOP_WINDOW_FUNC */
655  struct
656  {
657  /* out-of-line state, modified by nodeWindowAgg.c */
660 
661  /* for EEOP_SUBPLAN */
662  struct
663  {
664  /* out-of-line state, created by nodeSubplan.c */
667 
668  /* for EEOP_AGG_*DESERIALIZE */
669  struct
670  {
672  int jumpnull;
674 
675  /* for EEOP_AGG_STRICT_INPUT_CHECK_NULLS / STRICT_INPUT_CHECK_ARGS */
676  struct
677  {
678  /*
679  * For EEOP_AGG_STRICT_INPUT_CHECK_ARGS args contains pointers to
680  * the NullableDatums that need to be checked for NULLs.
681  *
682  * For EEOP_AGG_STRICT_INPUT_CHECK_NULLS nulls contains pointers
683  * to booleans that need to be checked for NULLs.
684  *
685  * Both cases currently need to exist because sometimes the
686  * to-be-checked nulls are in TupleTableSlot.isnull array, and
687  * sometimes in FunctionCallInfoBaseData.args[i].isnull.
688  */
690  bool *nulls;
691  int nargs;
692  int jumpnull;
694 
695  /* for EEOP_AGG_PLAIN_PERGROUP_NULLCHECK */
696  struct
697  {
698  int setoff;
699  int jumpnull;
701 
702  /* for EEOP_AGG_PRESORTED_DISTINCT_{SINGLE,MULTI} */
703  struct
704  {
709 
710  /* for EEOP_AGG_PLAIN_TRANS_[INIT_][STRICT_]{BYVAL,BYREF} */
711  /* for EEOP_AGG_ORDERED_TRANS_{DATUM,TUPLE} */
712  struct
713  {
716  int setno;
717  int transno;
718  int setoff;
720 
721  /* for EEOP_IS_JSON */
722  struct
723  {
724  JsonIsPredicate *pred; /* original expression node */
726 
727  /* for EEOP_JSONEXPR_PATH */
728  struct
729  {
732 
733  /* for EEOP_JSONEXPR_COERCION */
734  struct
735  {
739  /* exists_* fields only relevant for JSON_EXISTS_OP. */
746  } d;
748 
749 /* Enforce the size rule given in the comment above */
751  "size of ExprEvalStep exceeds 64 bytes");
752 
753 
754 /* Non-inline data for container operations */
755 typedef struct SubscriptingRefState
756 {
757  bool isassignment; /* is it assignment, or just fetch? */
758 
759  /* workspace for type-specific subscripting code */
760  void *workspace;
761 
762  /* numupper and upperprovided[] are filled at expression compile time */
763  /* at runtime, subscripts are computed in upperindex[]/upperindexnull[] */
764  int numupper;
765  bool *upperprovided; /* indicates if this position is supplied */
768 
769  /* similarly for lower indexes, if any */
770  int numlower;
774 
775  /* for assignment, new value to assign is evaluated into here */
778 
779  /* if we have a nested assignment, sbs_fetch_old puts old value here */
781  bool prevnull;
783 
784 /* Execution step methods used for SubscriptingRef */
785 typedef struct SubscriptExecSteps
786 {
787  /* See nodes/subscripting.h for more detail about these */
789  ExecEvalSubroutine sbs_fetch; /* fetch an element */
790  ExecEvalSubroutine sbs_assign; /* assign to an element */
791  ExecEvalSubroutine sbs_fetch_old; /* fetch old value for assignment */
793 
794 /* EEOP_JSON_CONSTRUCTOR state, too big to inline */
796 {
799  bool *arg_nulls;
801  struct
802  {
803  int category;
805  } *arg_type_cache; /* cache for datum_to_json[b]() */
806  int nargs;
808 
809 
810 /* functions in execExpr.c */
811 extern void ExprEvalPushStep(ExprState *es, const ExprEvalStep *s);
812 
813 /* functions in execExprInterp.c */
816 
817 extern Datum ExecInterpExprStillValid(ExprState *state, ExprContext *econtext, bool *isNull);
818 extern void CheckExprStillValid(ExprState *state, ExprContext *econtext);
819 
820 /*
821  * Non fast-path execution functions. These are externs instead of statics in
822  * execExprInterp.c, because that allows them to be used by other methods of
823  * expression evaluation, reducing code duplication.
824  */
826  ExprContext *econtext);
828  ExprContext *econtext);
830  ExprContext *econtext);
831 extern void ExecEvalParamSet(ExprState *state, ExprEvalStep *op,
832  ExprContext *econtext);
834  ExprContext *econtext);
839 extern void ExecEvalRowNull(ExprState *state, ExprEvalStep *op,
840  ExprContext *econtext);
842  ExprContext *econtext);
843 extern void ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op);
845  ExprContext *econtext);
846 extern void ExecEvalRow(ExprState *state, ExprEvalStep *op);
847 extern void ExecEvalMinMax(ExprState *state, ExprEvalStep *op);
849  ExprContext *econtext);
851  ExprContext *econtext);
853  ExprContext *econtext);
855  ExprContext *econtext);
858  ExprContext *econtext);
861 extern void ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op);
863  ExprContext *econtext);
866  ExprContext *econtext);
868  ExprContext *econtext);
872  ExprContext *econtext);
873 extern void ExecEvalSubPlan(ExprState *state, ExprEvalStep *op,
874  ExprContext *econtext);
876  ExprContext *econtext);
877 extern void ExecEvalSysVar(ExprState *state, ExprEvalStep *op,
878  ExprContext *econtext, TupleTableSlot *slot);
879 
880 extern void ExecAggInitGroup(AggState *aggstate, AggStatePerTrans pertrans, AggStatePerGroup pergroup,
881  ExprContext *aggcontext);
882 extern Datum ExecAggCopyTransValue(AggState *aggstate, AggStatePerTrans pertrans,
883  Datum newValue, bool newValueIsNull,
884  Datum oldValue, bool oldValueIsNull);
885 extern bool ExecEvalPreOrderedDistinctSingle(AggState *aggstate,
886  AggStatePerTrans pertrans);
887 extern bool ExecEvalPreOrderedDistinctMulti(AggState *aggstate,
888  AggStatePerTrans pertrans);
890  ExprContext *econtext);
892  ExprContext *econtext);
893 
894 #endif /* EXEC_EXPR_H */
int16 AttrNumber
Definition: attnum.h:21
signed short int16
Definition: c.h:481
signed int int32
Definition: c.h:482
void ExecEvalParamExtern(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalFieldStoreForm(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalGroupingFunc(ExprState *state, ExprEvalStep *op)
struct SubscriptExecSteps SubscriptExecSteps
void ExecEvalRow(ExprState *state, ExprEvalStep *op)
void ExecEvalFieldStoreDeForm(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalCurrentOfExpr(ExprState *state, ExprEvalStep *op)
void ExecEvalSQLValueFunction(ExprState *state, ExprEvalStep *op)
void ExecEvalRowNull(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
struct SubscriptingRefState SubscriptingRefState
void ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op)
void ExecEvalParamSet(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalCoerceViaIOSafe(ExprState *state, ExprEvalStep *op)
Datum ExecInterpExprStillValid(ExprState *state, ExprContext *econtext, bool *isNull)
void ExecEvalConvertRowtype(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
bool ExecEvalPreOrderedDistinctMulti(AggState *aggstate, AggStatePerTrans pertrans)
void ExecEvalFieldSelect(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
int ExecEvalJsonExprPath(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalConstraintNotNull(ExprState *state, ExprEvalStep *op)
void ExprEvalPushStep(ExprState *es, const ExprEvalStep *s)
Definition: execExpr.c:2592
void ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op)
void ExecEvalAggOrderedTransDatum(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalParamExec(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalJsonCoercion(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
struct ExprEvalRowtypeCache ExprEvalRowtypeCache
void ExecAggInitGroup(AggState *aggstate, AggStatePerTrans pertrans, AggStatePerGroup pergroup, ExprContext *aggcontext)
void ExecEvalNextValueExpr(ExprState *state, ExprEvalStep *op)
void ExecEvalSysVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext, TupleTableSlot *slot)
void ExecEvalMinMax(ExprState *state, ExprEvalStep *op)
void ExecEvalSubPlan(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalJsonIsPredicate(ExprState *state, ExprEvalStep *op)
bool(* ExecEvalBoolSubroutine)(ExprState *state, struct ExprEvalStep *op, ExprContext *econtext)
Definition: execExpr.h:39
Datum ExecAggCopyTransValue(AggState *aggstate, AggStatePerTrans pertrans, Datum newValue, bool newValueIsNull, Datum oldValue, bool oldValueIsNull)
struct ExprEvalStep ExprEvalStep
void ExecEvalMergeSupportFunc(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void CheckExprStillValid(ExprState *state, ExprContext *econtext)
void ExecEvalJsonConstructor(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalHashedScalarArrayOp(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalJsonCoercionFinish(ExprState *state, ExprEvalStep *op)
void ExecReadyInterpretedExpr(ExprState *state)
void ExecEvalRowNotNull(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
ExprEvalOp ExecEvalStepOp(ExprState *state, ExprEvalStep *op)
void(* ExecEvalSubroutine)(ExprState *state, struct ExprEvalStep *op, ExprContext *econtext)
Definition: execExpr.h:34
ExprEvalOp
Definition: execExpr.h:67
@ EEOP_ASSIGN_TMP
Definition: execExpr.h:99
@ EEOP_SUBPLAN
Definition: execExpr.h:259
@ EEOP_CONVERT_ROWTYPE
Definition: execExpr.h:246
@ EEOP_FUNCEXPR_STRICT_FUSAGE
Definition: execExpr.h:114
@ EEOP_ARRAYEXPR
Definition: execExpr.h:181
@ EEOP_JSONEXPR_PATH
Definition: execExpr.h:252
@ EEOP_NOT_DISTINCT
Definition: execExpr.h:176
@ EEOP_DOMAIN_TESTVAL
Definition: execExpr.h:230
@ EEOP_PARAM_EXTERN
Definition: execExpr.h:161
@ EEOP_HASHDATUM_NEXT32_STRICT
Definition: execExpr.h:243
@ EEOP_IOCOERCE_SAFE
Definition: execExpr.h:174
@ EEOP_BOOL_AND_STEP
Definition: execExpr.h:123
@ EEOP_WHOLEROW
Definition: execExpr.h:87
@ EEOP_JSONEXPR_COERCION_FINISH
Definition: execExpr.h:254
@ EEOP_HASHDATUM_FIRST_STRICT
Definition: execExpr.h:241
@ EEOP_AGGREF
Definition: execExpr.h:255
@ EEOP_INNER_VAR
Definition: execExpr.h:77
@ EEOP_AGG_PLAIN_PERGROUP_NULLCHECK
Definition: execExpr.h:266
@ EEOP_HASHDATUM_NEXT32
Definition: execExpr.h:242
@ EEOP_ROWCOMPARE_FINAL
Definition: execExpr.h:192
@ EEOP_AGG_STRICT_DESERIALIZE
Definition: execExpr.h:262
@ EEOP_IOCOERCE
Definition: execExpr.h:173
@ EEOP_GROUPING_FUNC
Definition: execExpr.h:256
@ EEOP_DOMAIN_CHECK
Definition: execExpr.h:236
@ EEOP_BOOLTEST_IS_NOT_FALSE
Definition: execExpr.h:157
@ EEOP_PARAM_SET
Definition: execExpr.h:164
@ EEOP_NEXTVALUEEXPR
Definition: execExpr.h:180
@ EEOP_DONE
Definition: execExpr.h:69
@ EEOP_AGG_PLAIN_TRANS_BYREF
Definition: execExpr.h:272
@ EEOP_QUAL
Definition: execExpr.h:135
@ EEOP_AGG_PRESORTED_DISTINCT_MULTI
Definition: execExpr.h:274
@ EEOP_AGG_PLAIN_TRANS_BYVAL
Definition: execExpr.h:269
@ EEOP_SCAN_VAR
Definition: execExpr.h:79
@ EEOP_BOOL_NOT_STEP
Definition: execExpr.h:132
@ EEOP_ASSIGN_SCAN_VAR
Definition: execExpr.h:96
@ EEOP_SCAN_SYSVAR
Definition: execExpr.h:84
@ EEOP_SCALARARRAYOP
Definition: execExpr.h:247
@ EEOP_DOMAIN_NOTNULL
Definition: execExpr.h:233
@ EEOP_WINDOW_FUNC
Definition: execExpr.h:257
@ EEOP_INNER_FETCHSOME
Definition: execExpr.h:72
@ EEOP_NULLTEST_ROWISNOTNULL
Definition: execExpr.h:151
@ EEOP_ASSIGN_OUTER_VAR
Definition: execExpr.h:95
@ EEOP_ROW
Definition: execExpr.h:183
@ EEOP_MAKE_READONLY
Definition: execExpr.h:170
@ EEOP_FIELDSTORE_FORM
Definition: execExpr.h:211
@ EEOP_SBSREF_SUBSCRIPTS
Definition: execExpr.h:214
@ EEOP_SBSREF_FETCH
Definition: execExpr.h:227
@ EEOP_FUNCEXPR_STRICT
Definition: execExpr.h:112
@ EEOP_NULLIF
Definition: execExpr.h:177
@ EEOP_CURRENTOFEXPR
Definition: execExpr.h:179
@ EEOP_INNER_SYSVAR
Definition: execExpr.h:82
@ EEOP_ASSIGN_TMP_MAKE_RO
Definition: execExpr.h:101
@ EEOP_CONST
Definition: execExpr.h:104
@ EEOP_BOOL_OR_STEP_LAST
Definition: execExpr.h:129
@ EEOP_JSONEXPR_COERCION
Definition: execExpr.h:253
@ EEOP_BOOL_OR_STEP_FIRST
Definition: execExpr.h:127
@ EEOP_XMLEXPR
Definition: execExpr.h:249
@ EEOP_AGG_STRICT_INPUT_CHECK_NULLS
Definition: execExpr.h:265
@ EEOP_SBSREF_ASSIGN
Definition: execExpr.h:224
@ EEOP_OUTER_SYSVAR
Definition: execExpr.h:83
@ EEOP_ASSIGN_INNER_VAR
Definition: execExpr.h:94
@ EEOP_BOOL_OR_STEP
Definition: execExpr.h:128
@ EEOP_OUTER_FETCHSOME
Definition: execExpr.h:73
@ EEOP_AGG_STRICT_INPUT_CHECK_ARGS
Definition: execExpr.h:264
@ EEOP_NULLTEST_ROWISNULL
Definition: execExpr.h:150
@ EEOP_BOOLTEST_IS_TRUE
Definition: execExpr.h:154
@ EEOP_FUNCEXPR
Definition: execExpr.h:111
@ EEOP_NULLTEST_ISNOTNULL
Definition: execExpr.h:147
@ EEOP_ROWCOMPARE_STEP
Definition: execExpr.h:189
@ EEOP_MERGE_SUPPORT_FUNC
Definition: execExpr.h:258
@ EEOP_AGG_DESERIALIZE
Definition: execExpr.h:263
@ EEOP_LAST
Definition: execExpr.h:279
@ EEOP_HASHDATUM_FIRST
Definition: execExpr.h:240
@ EEOP_DISTINCT
Definition: execExpr.h:175
@ EEOP_JUMP_IF_NOT_TRUE
Definition: execExpr.h:143
@ EEOP_FUNCEXPR_FUSAGE
Definition: execExpr.h:113
@ EEOP_AGG_PRESORTED_DISTINCT_SINGLE
Definition: execExpr.h:273
@ EEOP_BOOL_AND_STEP_FIRST
Definition: execExpr.h:122
@ EEOP_JUMP
Definition: execExpr.h:138
@ EEOP_PARAM_CALLBACK
Definition: execExpr.h:162
@ EEOP_BOOL_AND_STEP_LAST
Definition: execExpr.h:124
@ EEOP_AGG_ORDERED_TRANS_DATUM
Definition: execExpr.h:275
@ EEOP_SBSREF_OLD
Definition: execExpr.h:221
@ EEOP_SQLVALUEFUNCTION
Definition: execExpr.h:178
@ EEOP_HASHDATUM_SET_INITVAL
Definition: execExpr.h:239
@ EEOP_JUMP_IF_NOT_NULL
Definition: execExpr.h:142
@ EEOP_AGG_PLAIN_TRANS_STRICT_BYREF
Definition: execExpr.h:271
@ EEOP_FIELDSTORE_DEFORM
Definition: execExpr.h:204
@ EEOP_BOOLTEST_IS_FALSE
Definition: execExpr.h:156
@ EEOP_BOOLTEST_IS_NOT_TRUE
Definition: execExpr.h:155
@ EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYVAL
Definition: execExpr.h:267
@ EEOP_PARAM_EXEC
Definition: execExpr.h:160
@ EEOP_JSON_CONSTRUCTOR
Definition: execExpr.h:250
@ EEOP_AGG_PLAIN_TRANS_STRICT_BYVAL
Definition: execExpr.h:268
@ EEOP_NULLTEST_ISNULL
Definition: execExpr.h:146
@ EEOP_MINMAX
Definition: execExpr.h:195
@ EEOP_JUMP_IF_NULL
Definition: execExpr.h:141
@ EEOP_ARRAYCOERCE
Definition: execExpr.h:182
@ EEOP_FIELDSELECT
Definition: execExpr.h:198
@ EEOP_CASE_TESTVAL
Definition: execExpr.h:167
@ EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYREF
Definition: execExpr.h:270
@ EEOP_HASHED_SCALARARRAYOP
Definition: execExpr.h:248
@ EEOP_OUTER_VAR
Definition: execExpr.h:78
@ EEOP_AGG_ORDERED_TRANS_TUPLE
Definition: execExpr.h:276
@ EEOP_SCAN_FETCHSOME
Definition: execExpr.h:74
@ EEOP_IS_JSON
Definition: execExpr.h:251
void ExecEvalConstraintCheck(ExprState *state, ExprEvalStep *op)
StaticAssertDecl(sizeof(ExprEvalStep)<=64, "size of ExprEvalStep exceeds 64 bytes")
void ExecEvalArrayCoerce(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalFuncExprStrictFusage(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalFuncExprFusage(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op)
bool ExecEvalPreOrderedDistinctSingle(AggState *aggstate, AggStatePerTrans pertrans)
struct JsonConstructorExprState JsonConstructorExprState
void ExecEvalAggOrderedTransTuple(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
Datum(* PGFunction)(FunctionCallInfo fcinfo)
Definition: fmgr.h:40
uintptr_t Datum
Definition: postgres.h:64
unsigned int Oid
Definition: postgres_ext.h:31
MinMaxOp
Definition: primnodes.h:1501
RowCompareType
Definition: primnodes.h:1453
XmlExpr * xexpr
Definition: execExpr.h:627
struct ExprEvalStep::@55::@95 subplan
JsonIsPredicate * pred
Definition: execExpr.h:724
struct ExprEvalStep::@55::@65 jump
Datum * value
Definition: execExpr.h:416
struct ExprEvalStep::@55::@93 grouping_func
Var * var
Definition: execExpr.h:329
void * paramarg
Definition: execExpr.h:408
bool * anynull
Definition: execExpr.h:374
ExprState * elemexprstate
Definition: execExpr.h:467
MinMaxOp op
Definition: execExpr.h:508
bool typbyval
Definition: execExpr.h:605
char elemalign
Definition: execExpr.h:460
struct ExprEvalStep::@55::@80 fieldselect
List * clauses
Definition: execExpr.h:651
WindowFuncExprState * wfstate
Definition: execExpr.h:658
void * json_coercion_cache
Definition: execExpr.h:743
ExecEvalBoolSubroutine subscriptfunc
Definition: execExpr.h:542
bool exists_coerce
Definition: execExpr.h:740
TupleDesc tupdesc
Definition: execExpr.h:332
Oid seqtypid
Definition: execExpr.h:448
ExprEvalRowtypeCache * rowcache
Definition: execExpr.h:531
int last_var
Definition: execExpr.h:308
JunkFilter * junkFilter
Definition: execExpr.h:333
struct ExprEvalStep::@55::@78 rowcompare_final
FmgrInfo * finfo_out
Definition: execExpr.h:431
AttrNumber fieldnum
Definition: execExpr.h:517
struct ExprEvalStep::@55::@86 hashdatum
bool has_nulls
Definition: execExpr.h:616
Datum * values
Definition: execExpr.h:504
bool * elemnulls
Definition: execExpr.h:455
struct ExprEvalStep::@55::@60 assign_tmp
bool * checknull
Definition: execExpr.h:563
int ncolumns
Definition: execExpr.h:536
bool * named_argnull
Definition: execExpr.h:630
struct ExprEvalStep::@55::@100 agg_trans
struct ExprEvalStep::@55::@57 var
struct ExprEvalStep::@55::@63 boolexpr
Oid outputtype
Definition: execExpr.h:591
struct ExprEvalStep::@55::@98 agg_plain_pergroup_nullcheck
struct ExprEvalStep::@55::@101 is_json
struct ExprEvalStep::@55::@91 json_constructor
struct ScalarArrayOpExprHashTable * elements_tab
Definition: execExpr.h:618
bool inclause
Definition: execExpr.h:617
struct SubscriptingRefState * state
Definition: execExpr.h:544
RowCompareType rctype
Definition: execExpr.h:497
SubPlanState * sstate
Definition: execExpr.h:665
bool multidims
Definition: execExpr.h:461
struct ExprEvalStep::@55::@88 scalararrayop
bool exists_cast_to_int
Definition: execExpr.h:741
struct ExprEvalStep::@55::@92 aggref
int16 elemlength
Definition: execExpr.h:458
AggStatePerTrans pertrans
Definition: execExpr.h:705
struct JsonExprState * jsestate
Definition: execExpr.h:730
bool * isnull
Definition: execExpr.h:417
TupleConversionMap * map
Definition: execExpr.h:595
bool * argnull
Definition: execExpr.h:633
struct ExprEvalStep::@55::@64 qualexpr
intptr_t opcode
Definition: execExpr.h:290
Oid inputtype
Definition: execExpr.h:590
char typalign
Definition: execExpr.h:606
ExecEvalSubroutine paramfunc
Definition: execExpr.h:407
FunctionCallInfo fcinfo_data_in
Definition: execExpr.h:435
struct ExprEvalStep::@55::@75 arraycoerce
bool elembyval
Definition: execExpr.h:459
PGFunction fn_addr
Definition: execExpr.h:366
struct ExprEvalStep::@55::@82 sbsref_subscript
TupleDesc known_desc
Definition: execExpr.h:312
NullableDatum * args
Definition: execExpr.h:689
int resultnum
Definition: execExpr.h:340
struct ExprEvalStep::@55::@76 row
struct ExprEvalStep::@55::@62 func
struct ExprEvalStep::@55::@94 window_func
bool * nulls
Definition: execExpr.h:505
Datum * resvalue
Definition: execExpr.h:293
Datum * elemvalues
Definition: execExpr.h:454
NullableDatum * iresult
Definition: execExpr.h:584
int jumpnull
Definition: execExpr.h:489
struct ExprEvalStep::@55::@77 rowcompare_step
struct ExprEvalStep::@55::@74 arrayexpr
Oid resulttype
Definition: execExpr.h:518
ExprEvalRowtypeCache * incache
Definition: execExpr.h:593
bool exists_check_domain
Definition: execExpr.h:742
ScalarArrayOpExpr * saop
Definition: execExpr.h:621
const TupleTableSlotOps * kind
Definition: execExpr.h:314
Oid resultelemtype
Definition: execExpr.h:468
struct ExprEvalStep::@55::@102 jsonexpr
FunctionCallInfo fcinfo_data
Definition: execExpr.h:364
int jumpdistinct
Definition: execExpr.h:707
Datum * checkvalue
Definition: execExpr.h:562
FmgrInfo * finfo_in
Definition: execExpr.h:434
int jumpdone
Definition: execExpr.h:375
Datum * named_argvalue
Definition: execExpr.h:629
struct ExprEvalStep::@55::@66 nulltest_row
struct ExprEvalStep::@55::@84 domaincheck
struct ExprEvalStep::@55::@103 jsonexpr_coercion
struct ExprEvalStep::@55::@70 make_readonly
ErrorSaveContext * escontext
Definition: execExpr.h:566
Oid paramtype
Definition: execExpr.h:401
union ExprEvalStep::@55 d
bool fixed
Definition: execExpr.h:310
struct ExprEvalStep::@55::@87 convert_rowtype
struct ExprEvalStep::@55::@73 nextvalueexpr
Datum value
Definition: execExpr.h:356
struct ExprEvalStep::@55::@90 xmlexpr
bool useOr
Definition: execExpr.h:603
int32 targettypmod
Definition: execExpr.h:737
struct ExprEvalStep::@55::@71 iocoerce
bool make_ro
Definition: execExpr.h:368
FieldStore * fstore
Definition: execExpr.h:527
struct ExprEvalStep::@55::@68 cparam
bool * resnull
Definition: execExpr.h:294
struct ExprEvalStep::@55::@58 wholerow
struct ExprEvalStep::@55::@69 casetest
FunctionCallInfo fcinfo_data_out
Definition: execExpr.h:432
ExecEvalSubroutine subscriptfunc
Definition: execExpr.h:551
ExprEvalRowtypeCache * outcache
Definition: execExpr.h:594
int16 typlen
Definition: execExpr.h:604
Datum * argvalue
Definition: execExpr.h:632
struct ExprEvalStep::@55::@83 sbsref
struct ExprEvalStep::@55::@72 sqlvaluefunction
struct ExprEvalStep::@55::@97 agg_strict_input_check
struct ExprEvalStep::@55::@61 constval
ExprEvalRowtypeCache rowcache
Definition: execExpr.h:394
Datum init_value
Definition: execExpr.h:572
struct ExprEvalStep::@55::@81 fieldstore
struct JsonConstructorExprState * jcstate
Definition: execExpr.h:639
struct ExprEvalStep::@55::@89 hashedscalararrayop
FmgrInfo * finfo
Definition: execExpr.h:363
bool isnull
Definition: execExpr.h:357
ExprContext * aggcontext
Definition: execExpr.h:706
Oid elemtype
Definition: execExpr.h:457
char * constraintname
Definition: execExpr.h:560
struct ExprEvalStep::@55::@56 fetch
struct ExprEvalStep::@55::@67 param
struct ExprEvalStep::@55::@85 hashdatum_initvalue
struct ExprEvalStep::@55::@59 assign_var
Oid element_type
Definition: execExpr.h:602
Oid targettype
Definition: execExpr.h:736
struct ExprEvalStep::@55::@99 agg_presorted_distinctcheck
struct ExprEvalStep::@55::@79 minmax
bool first
Definition: execExpr.h:330
struct ArrayMapState * amstate
Definition: execExpr.h:469
bool omit_quotes
Definition: execExpr.h:738
SQLValueFunction * svf
Definition: execExpr.h:441
struct ExprEvalStep::@55::@96 agg_deserialize
Definition: fmgr.h:57
JsonConstructorExpr * constructor
Definition: execExpr.h:797
struct JsonConstructorExprState::@104 * arg_type_cache
Definition: pg_list.h:54
ExecEvalSubroutine sbs_fetch_old
Definition: execExpr.h:791
ExecEvalBoolSubroutine sbs_check_subscripts
Definition: execExpr.h:788
ExecEvalSubroutine sbs_assign
Definition: execExpr.h:790
ExecEvalSubroutine sbs_fetch
Definition: execExpr.h:789
Definition: primnodes.h:248
Definition: regguts.h:323