gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

768 lines
21KB

  1. /*-------------------------------------------------------------------------
  2. *
  3. * execExpr.h
  4. * Low level infrastructure related to expression evaluation
  5. *
  6. *
  7. * Portions Copyright (c) 1996-2019, 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. #include "executor/nodeAgg.h"
  17. #include "nodes/execnodes.h"
  18. /* forward references to avoid circularity */
  19. struct ExprEvalStep;
  20. struct SubscriptingRefState;
  21. /* Bits in ExprState->flags (see also execnodes.h for public flag bits): */
  22. /* expression's interpreter has been initialized */
  23. #define EEO_FLAG_INTERPRETER_INITIALIZED (1 << 1)
  24. /* jump-threading is in use */
  25. #define EEO_FLAG_DIRECT_THREADED (1 << 2)
  26. /* Typical API for out-of-line evaluation subroutines */
  27. typedef void (*ExecEvalSubroutine) (ExprState *state,
  28. struct ExprEvalStep *op,
  29. ExprContext *econtext);
  30. /*
  31. * Discriminator for ExprEvalSteps.
  32. *
  33. * Identifies the operation to be executed and which member in the
  34. * ExprEvalStep->d union is valid.
  35. *
  36. * The order of entries needs to be kept in sync with the dispatch_table[]
  37. * array in execExprInterp.c:ExecInterpExpr().
  38. */
  39. typedef enum ExprEvalOp
  40. {
  41. /* entire expression has been evaluated completely, return */
  42. EEOP_DONE,
  43. /* apply slot_getsomeattrs on corresponding tuple slot */
  44. EEOP_INNER_FETCHSOME,
  45. EEOP_OUTER_FETCHSOME,
  46. EEOP_SCAN_FETCHSOME,
  47. /* compute non-system Var value */
  48. EEOP_INNER_VAR,
  49. EEOP_OUTER_VAR,
  50. EEOP_SCAN_VAR,
  51. /* compute system Var value */
  52. EEOP_INNER_SYSVAR,
  53. EEOP_OUTER_SYSVAR,
  54. EEOP_SCAN_SYSVAR,
  55. /* compute wholerow Var */
  56. EEOP_WHOLEROW,
  57. /*
  58. * Compute non-system Var value, assign it into ExprState's resultslot.
  59. * These are not used if a CheckVarSlotCompatibility() check would be
  60. * needed.
  61. */
  62. EEOP_ASSIGN_INNER_VAR,
  63. EEOP_ASSIGN_OUTER_VAR,
  64. EEOP_ASSIGN_SCAN_VAR,
  65. /* assign ExprState's resvalue/resnull to a column of its resultslot */
  66. EEOP_ASSIGN_TMP,
  67. /* ditto, applying MakeExpandedObjectReadOnly() */
  68. EEOP_ASSIGN_TMP_MAKE_RO,
  69. /* evaluate Const value */
  70. EEOP_CONST,
  71. /*
  72. * Evaluate function call (including OpExprs etc). For speed, we
  73. * distinguish in the opcode whether the function is strict and/or
  74. * requires usage stats tracking.
  75. */
  76. EEOP_FUNCEXPR,
  77. EEOP_FUNCEXPR_STRICT,
  78. EEOP_FUNCEXPR_FUSAGE,
  79. EEOP_FUNCEXPR_STRICT_FUSAGE,
  80. /*
  81. * Evaluate boolean AND expression, one step per subexpression. FIRST/LAST
  82. * subexpressions are special-cased for performance. Since AND always has
  83. * at least two subexpressions, FIRST and LAST never apply to the same
  84. * subexpression.
  85. */
  86. EEOP_BOOL_AND_STEP_FIRST,
  87. EEOP_BOOL_AND_STEP,
  88. EEOP_BOOL_AND_STEP_LAST,
  89. /* similarly for boolean OR expression */
  90. EEOP_BOOL_OR_STEP_FIRST,
  91. EEOP_BOOL_OR_STEP,
  92. EEOP_BOOL_OR_STEP_LAST,
  93. /* evaluate boolean NOT expression */
  94. EEOP_BOOL_NOT_STEP,
  95. /* simplified version of BOOL_AND_STEP for use by ExecQual() */
  96. EEOP_QUAL,
  97. /* unconditional jump to another step */
  98. EEOP_JUMP,
  99. /* conditional jumps based on current result value */
  100. EEOP_JUMP_IF_NULL,
  101. EEOP_JUMP_IF_NOT_NULL,
  102. EEOP_JUMP_IF_NOT_TRUE,
  103. /* perform NULL tests for scalar values */
  104. EEOP_NULLTEST_ISNULL,
  105. EEOP_NULLTEST_ISNOTNULL,
  106. /* perform NULL tests for row values */
  107. EEOP_NULLTEST_ROWISNULL,
  108. EEOP_NULLTEST_ROWISNOTNULL,
  109. /* evaluate a BooleanTest expression */
  110. EEOP_BOOLTEST_IS_TRUE,
  111. EEOP_BOOLTEST_IS_NOT_TRUE,
  112. EEOP_BOOLTEST_IS_FALSE,
  113. EEOP_BOOLTEST_IS_NOT_FALSE,
  114. /* evaluate PARAM_EXEC/EXTERN parameters */
  115. EEOP_PARAM_EXEC,
  116. EEOP_PARAM_EXTERN,
  117. EEOP_PARAM_CALLBACK,
  118. /* return CaseTestExpr value */
  119. EEOP_CASE_TESTVAL,
  120. /* apply MakeExpandedObjectReadOnly() to target value */
  121. EEOP_MAKE_READONLY,
  122. /* evaluate assorted special-purpose expression types */
  123. EEOP_IOCOERCE,
  124. EEOP_DISTINCT,
  125. EEOP_NOT_DISTINCT,
  126. EEOP_NULLIF,
  127. EEOP_SQLVALUEFUNCTION,
  128. EEOP_CURRENTOFEXPR,
  129. EEOP_NEXTVALUEEXPR,
  130. EEOP_ARRAYEXPR,
  131. EEOP_ARRAYCOERCE,
  132. EEOP_ROW,
  133. /*
  134. * Compare two individual elements of each of two compared ROW()
  135. * expressions. Skip to ROWCOMPARE_FINAL if elements are not equal.
  136. */
  137. EEOP_ROWCOMPARE_STEP,
  138. /* evaluate boolean value based on previous ROWCOMPARE_STEP operations */
  139. EEOP_ROWCOMPARE_FINAL,
  140. /* evaluate GREATEST() or LEAST() */
  141. EEOP_MINMAX,
  142. /* evaluate FieldSelect expression */
  143. EEOP_FIELDSELECT,
  144. /*
  145. * Deform tuple before evaluating new values for individual fields in a
  146. * FieldStore expression.
  147. */
  148. EEOP_FIELDSTORE_DEFORM,
  149. /*
  150. * Form the new tuple for a FieldStore expression. Individual fields will
  151. * have been evaluated into columns of the tuple deformed by the preceding
  152. * DEFORM step.
  153. */
  154. EEOP_FIELDSTORE_FORM,
  155. /* Process a container subscript; short-circuit expression to NULL if NULL */
  156. EEOP_SBSREF_SUBSCRIPT,
  157. /*
  158. * Compute old container element/slice when a SubscriptingRef assignment
  159. * expression contains SubscriptingRef/FieldStore subexpressions. Value is
  160. * accessed using the CaseTest mechanism.
  161. */
  162. EEOP_SBSREF_OLD,
  163. /* compute new value for SubscriptingRef assignment expression */
  164. EEOP_SBSREF_ASSIGN,
  165. /* compute element/slice for SubscriptingRef fetch expression */
  166. EEOP_SBSREF_FETCH,
  167. /* evaluate value for CoerceToDomainValue */
  168. EEOP_DOMAIN_TESTVAL,
  169. /* evaluate a domain's NOT NULL constraint */
  170. EEOP_DOMAIN_NOTNULL,
  171. /* evaluate a single domain CHECK constraint */
  172. EEOP_DOMAIN_CHECK,
  173. /* evaluate assorted special-purpose expression types */
  174. EEOP_CONVERT_ROWTYPE,
  175. EEOP_SCALARARRAYOP,
  176. EEOP_XMLEXPR,
  177. EEOP_AGGREF,
  178. EEOP_GROUPING_FUNC,
  179. EEOP_WINDOW_FUNC,
  180. EEOP_SUBPLAN,
  181. EEOP_ALTERNATIVE_SUBPLAN,
  182. /* aggregation related nodes */
  183. EEOP_AGG_STRICT_DESERIALIZE,
  184. EEOP_AGG_DESERIALIZE,
  185. EEOP_AGG_STRICT_INPUT_CHECK_ARGS,
  186. EEOP_AGG_STRICT_INPUT_CHECK_NULLS,
  187. EEOP_AGG_INIT_TRANS,
  188. EEOP_AGG_STRICT_TRANS_CHECK,
  189. EEOP_AGG_PLAIN_TRANS_BYVAL,
  190. EEOP_AGG_PLAIN_TRANS,
  191. EEOP_AGG_ORDERED_TRANS_DATUM,
  192. EEOP_AGG_ORDERED_TRANS_TUPLE,
  193. /* non-existent operation, used e.g. to check array lengths */
  194. EEOP_LAST
  195. } ExprEvalOp;
  196. typedef struct ExprEvalStep
  197. {
  198. /*
  199. * Instruction to be executed. During instruction preparation this is an
  200. * enum ExprEvalOp, but later it can be changed to some other type, e.g. a
  201. * pointer for computed goto (that's why it's an intptr_t).
  202. */
  203. intptr_t opcode;
  204. /* where to store the result of this step */
  205. Datum *resvalue;
  206. bool *resnull;
  207. /*
  208. * Inline data for the operation. Inline data is faster to access, but
  209. * also bloats the size of all instructions. The union should be kept to
  210. * no more than 40 bytes on 64-bit systems (so that the entire struct is
  211. * no more than 64 bytes, a single cacheline on common systems).
  212. */
  213. union
  214. {
  215. /* for EEOP_INNER/OUTER/SCAN_FETCHSOME */
  216. struct
  217. {
  218. /* attribute number up to which to fetch (inclusive) */
  219. int last_var;
  220. /* will the type of slot be the same for every invocation */
  221. bool fixed;
  222. /* tuple descriptor, if known */
  223. TupleDesc known_desc;
  224. /* type of slot, can only be relied upon if fixed is set */
  225. const TupleTableSlotOps *kind;
  226. } fetch;
  227. /* for EEOP_INNER/OUTER/SCAN_[SYS]VAR[_FIRST] */
  228. struct
  229. {
  230. /* attnum is attr number - 1 for regular VAR ... */
  231. /* but it's just the normal (negative) attr number for SYSVAR */
  232. int attnum;
  233. Oid vartype; /* type OID of variable */
  234. } var;
  235. /* for EEOP_WHOLEROW */
  236. struct
  237. {
  238. Var *var; /* original Var node in plan tree */
  239. bool first; /* first time through, need to initialize? */
  240. bool slow; /* need runtime check for nulls? */
  241. TupleDesc tupdesc; /* descriptor for resulting tuples */
  242. JunkFilter *junkFilter; /* JunkFilter to remove resjunk cols */
  243. } wholerow;
  244. /* for EEOP_ASSIGN_*_VAR */
  245. struct
  246. {
  247. /* target index in ExprState->resultslot->tts_values/nulls */
  248. int resultnum;
  249. /* source attribute number - 1 */
  250. int attnum;
  251. } assign_var;
  252. /* for EEOP_ASSIGN_TMP[_MAKE_RO] */
  253. struct
  254. {
  255. /* target index in ExprState->resultslot->tts_values/nulls */
  256. int resultnum;
  257. } assign_tmp;
  258. /* for EEOP_CONST */
  259. struct
  260. {
  261. /* constant's value */
  262. Datum value;
  263. bool isnull;
  264. } constval;
  265. /* for EEOP_FUNCEXPR_* / NULLIF / DISTINCT */
  266. struct
  267. {
  268. FmgrInfo *finfo; /* function's lookup data */
  269. FunctionCallInfo fcinfo_data; /* arguments etc */
  270. /* faster to access without additional indirection: */
  271. PGFunction fn_addr; /* actual call address */
  272. int nargs; /* number of arguments */
  273. } func;
  274. /* for EEOP_BOOL_*_STEP */
  275. struct
  276. {
  277. bool *anynull; /* track if any input was NULL */
  278. int jumpdone; /* jump here if result determined */
  279. } boolexpr;
  280. /* for EEOP_QUAL */
  281. struct
  282. {
  283. int jumpdone; /* jump here on false or null */
  284. } qualexpr;
  285. /* for EEOP_JUMP[_CONDITION] */
  286. struct
  287. {
  288. int jumpdone; /* target instruction's index */
  289. } jump;
  290. /* for EEOP_NULLTEST_ROWIS[NOT]NULL */
  291. struct
  292. {
  293. /* cached tupdesc pointer - filled at runtime */
  294. TupleDesc argdesc;
  295. } nulltest_row;
  296. /* for EEOP_PARAM_EXEC/EXTERN */
  297. struct
  298. {
  299. int paramid; /* numeric ID for parameter */
  300. Oid paramtype; /* OID of parameter's datatype */
  301. } param;
  302. /* for EEOP_PARAM_CALLBACK */
  303. struct
  304. {
  305. ExecEvalSubroutine paramfunc; /* add-on evaluation subroutine */
  306. void *paramarg; /* private data for same */
  307. int paramid; /* numeric ID for parameter */
  308. Oid paramtype; /* OID of parameter's datatype */
  309. } cparam;
  310. /* for EEOP_CASE_TESTVAL/DOMAIN_TESTVAL */
  311. struct
  312. {
  313. Datum *value; /* value to return */
  314. bool *isnull;
  315. } casetest;
  316. /* for EEOP_MAKE_READONLY */
  317. struct
  318. {
  319. Datum *value; /* value to coerce to read-only */
  320. bool *isnull;
  321. } make_readonly;
  322. /* for EEOP_IOCOERCE */
  323. struct
  324. {
  325. /* lookup and call info for source type's output function */
  326. FmgrInfo *finfo_out;
  327. FunctionCallInfo fcinfo_data_out;
  328. /* lookup and call info for result type's input function */
  329. FmgrInfo *finfo_in;
  330. FunctionCallInfo fcinfo_data_in;
  331. } iocoerce;
  332. /* for EEOP_SQLVALUEFUNCTION */
  333. struct
  334. {
  335. SQLValueFunction *svf;
  336. } sqlvaluefunction;
  337. /* for EEOP_NEXTVALUEEXPR */
  338. struct
  339. {
  340. Oid seqid;
  341. Oid seqtypid;
  342. } nextvalueexpr;
  343. /* for EEOP_ARRAYEXPR */
  344. struct
  345. {
  346. Datum *elemvalues; /* element values get stored here */
  347. bool *elemnulls;
  348. int nelems; /* length of the above arrays */
  349. Oid elemtype; /* array element type */
  350. int16 elemlength; /* typlen of the array element type */
  351. bool elembyval; /* is the element type pass-by-value? */
  352. char elemalign; /* typalign of the element type */
  353. bool multidims; /* is array expression multi-D? */
  354. } arrayexpr;
  355. /* for EEOP_ARRAYCOERCE */
  356. struct
  357. {
  358. ExprState *elemexprstate; /* null if no per-element work */
  359. Oid resultelemtype; /* element type of result array */
  360. struct ArrayMapState *amstate; /* workspace for array_map */
  361. } arraycoerce;
  362. /* for EEOP_ROW */
  363. struct
  364. {
  365. TupleDesc tupdesc; /* descriptor for result tuples */
  366. /* workspace for the values constituting the row: */
  367. Datum *elemvalues;
  368. bool *elemnulls;
  369. } row;
  370. /* for EEOP_ROWCOMPARE_STEP */
  371. struct
  372. {
  373. /* lookup and call data for column comparison function */
  374. FmgrInfo *finfo;
  375. FunctionCallInfo fcinfo_data;
  376. PGFunction fn_addr;
  377. /* target for comparison resulting in NULL */
  378. int jumpnull;
  379. /* target for comparison yielding inequality */
  380. int jumpdone;
  381. } rowcompare_step;
  382. /* for EEOP_ROWCOMPARE_FINAL */
  383. struct
  384. {
  385. RowCompareType rctype;
  386. } rowcompare_final;
  387. /* for EEOP_MINMAX */
  388. struct
  389. {
  390. /* workspace for argument values */
  391. Datum *values;
  392. bool *nulls;
  393. int nelems;
  394. /* is it GREATEST or LEAST? */
  395. MinMaxOp op;
  396. /* lookup and call data for comparison function */
  397. FmgrInfo *finfo;
  398. FunctionCallInfo fcinfo_data;
  399. } minmax;
  400. /* for EEOP_FIELDSELECT */
  401. struct
  402. {
  403. AttrNumber fieldnum; /* field number to extract */
  404. Oid resulttype; /* field's type */
  405. /* cached tupdesc pointer - filled at runtime */
  406. TupleDesc argdesc;
  407. } fieldselect;
  408. /* for EEOP_FIELDSTORE_DEFORM / FIELDSTORE_FORM */
  409. struct
  410. {
  411. /* original expression node */
  412. FieldStore *fstore;
  413. /* cached tupdesc pointer - filled at runtime */
  414. /* note that a DEFORM and FORM pair share the same tupdesc */
  415. TupleDesc *argdesc;
  416. /* workspace for column values */
  417. Datum *values;
  418. bool *nulls;
  419. int ncolumns;
  420. } fieldstore;
  421. /* for EEOP_SBSREF_SUBSCRIPT */
  422. struct
  423. {
  424. /* too big to have inline */
  425. struct SubscriptingRefState *state;
  426. int off; /* 0-based index of this subscript */
  427. bool isupper; /* is it upper or lower subscript? */
  428. int jumpdone; /* jump here on null */
  429. } sbsref_subscript;
  430. /* for EEOP_SBSREF_OLD / ASSIGN / FETCH */
  431. struct
  432. {
  433. /* too big to have inline */
  434. struct SubscriptingRefState *state;
  435. } sbsref;
  436. /* for EEOP_DOMAIN_NOTNULL / DOMAIN_CHECK */
  437. struct
  438. {
  439. /* name of constraint */
  440. char *constraintname;
  441. /* where the result of a CHECK constraint will be stored */
  442. Datum *checkvalue;
  443. bool *checknull;
  444. /* OID of domain type */
  445. Oid resulttype;
  446. } domaincheck;
  447. /* for EEOP_CONVERT_ROWTYPE */
  448. struct
  449. {
  450. ConvertRowtypeExpr *convert; /* original expression */
  451. /* these three fields are filled at runtime: */
  452. TupleDesc indesc; /* tupdesc for input type */
  453. TupleDesc outdesc; /* tupdesc for output type */
  454. TupleConversionMap *map; /* column mapping */
  455. bool initialized; /* initialized for current types? */
  456. } convert_rowtype;
  457. /* for EEOP_SCALARARRAYOP */
  458. struct
  459. {
  460. /* element_type/typlen/typbyval/typalign are filled at runtime */
  461. Oid element_type; /* InvalidOid if not yet filled */
  462. bool useOr; /* use OR or AND semantics? */
  463. int16 typlen; /* array element type storage info */
  464. bool typbyval;
  465. char typalign;
  466. FmgrInfo *finfo; /* function's lookup data */
  467. FunctionCallInfo fcinfo_data; /* arguments etc */
  468. /* faster to access without additional indirection: */
  469. PGFunction fn_addr; /* actual call address */
  470. } scalararrayop;
  471. /* for EEOP_XMLEXPR */
  472. struct
  473. {
  474. XmlExpr *xexpr; /* original expression node */
  475. /* workspace for evaluating named args, if any */
  476. Datum *named_argvalue;
  477. bool *named_argnull;
  478. /* workspace for evaluating unnamed args, if any */
  479. Datum *argvalue;
  480. bool *argnull;
  481. } xmlexpr;
  482. /* for EEOP_AGGREF */
  483. struct
  484. {
  485. /* out-of-line state, modified by nodeAgg.c */
  486. AggrefExprState *astate;
  487. } aggref;
  488. /* for EEOP_GROUPING_FUNC */
  489. struct
  490. {
  491. AggState *parent; /* parent Agg */
  492. List *clauses; /* integer list of column numbers */
  493. } grouping_func;
  494. /* for EEOP_WINDOW_FUNC */
  495. struct
  496. {
  497. /* out-of-line state, modified by nodeWindowFunc.c */
  498. WindowFuncExprState *wfstate;
  499. } window_func;
  500. /* for EEOP_SUBPLAN */
  501. struct
  502. {
  503. /* out-of-line state, created by nodeSubplan.c */
  504. SubPlanState *sstate;
  505. } subplan;
  506. /* for EEOP_ALTERNATIVE_SUBPLAN */
  507. struct
  508. {
  509. /* out-of-line state, created by nodeSubplan.c */
  510. AlternativeSubPlanState *asstate;
  511. } alternative_subplan;
  512. /* for EEOP_AGG_*DESERIALIZE */
  513. struct
  514. {
  515. AggState *aggstate;
  516. FunctionCallInfo fcinfo_data;
  517. int jumpnull;
  518. } agg_deserialize;
  519. /* for EEOP_AGG_STRICT_INPUT_CHECK_NULLS / STRICT_INPUT_CHECK_ARGS */
  520. struct
  521. {
  522. /*
  523. * For EEOP_AGG_STRICT_INPUT_CHECK_ARGS args contains pointers to
  524. * the NullableDatums that need to be checked for NULLs.
  525. *
  526. * For EEOP_AGG_STRICT_INPUT_CHECK_NULLS nulls contains pointers
  527. * to booleans that need to be checked for NULLs.
  528. *
  529. * Both cases currently need to exist because sometimes the
  530. * to-be-checked nulls are in TupleTableSlot.isnull array, and
  531. * sometimes in FunctionCallInfoBaseData.args[i].isnull.
  532. */
  533. NullableDatum *args;
  534. bool *nulls;
  535. int nargs;
  536. int jumpnull;
  537. } agg_strict_input_check;
  538. /* for EEOP_AGG_INIT_TRANS */
  539. struct
  540. {
  541. AggState *aggstate;
  542. AggStatePerTrans pertrans;
  543. ExprContext *aggcontext;
  544. int setno;
  545. int transno;
  546. int setoff;
  547. int jumpnull;
  548. } agg_init_trans;
  549. /* for EEOP_AGG_STRICT_TRANS_CHECK */
  550. struct
  551. {
  552. AggState *aggstate;
  553. int setno;
  554. int transno;
  555. int setoff;
  556. int jumpnull;
  557. } agg_strict_trans_check;
  558. /* for EEOP_AGG_{PLAIN,ORDERED}_TRANS* */
  559. struct
  560. {
  561. AggState *aggstate;
  562. AggStatePerTrans pertrans;
  563. ExprContext *aggcontext;
  564. int setno;
  565. int transno;
  566. int setoff;
  567. } agg_trans;
  568. } d;
  569. } ExprEvalStep;
  570. /* Non-inline data for container operations */
  571. typedef struct SubscriptingRefState
  572. {
  573. bool isassignment; /* is it assignment, or just fetch? */
  574. Oid refelemtype; /* OID of the container element type */
  575. int16 refattrlength; /* typlen of container type */
  576. int16 refelemlength; /* typlen of the container element type */
  577. bool refelembyval; /* is the element type pass-by-value? */
  578. char refelemalign; /* typalign of the element type */
  579. /* numupper and upperprovided[] are filled at compile time */
  580. /* at runtime, extracted subscript datums get stored in upperindex[] */
  581. int numupper;
  582. bool upperprovided[MAXDIM];
  583. int upperindex[MAXDIM];
  584. /* similarly for lower indexes, if any */
  585. int numlower;
  586. bool lowerprovided[MAXDIM];
  587. int lowerindex[MAXDIM];
  588. /* subscript expressions get evaluated into here */
  589. Datum subscriptvalue;
  590. bool subscriptnull;
  591. /* for assignment, new value to assign is evaluated into here */
  592. Datum replacevalue;
  593. bool replacenull;
  594. /* if we have a nested assignment, SBSREF_OLD puts old value here */
  595. Datum prevvalue;
  596. bool prevnull;
  597. } SubscriptingRefState;
  598. /* functions in execExpr.c */
  599. extern void ExprEvalPushStep(ExprState *es, const ExprEvalStep *s);
  600. /* functions in execExprInterp.c */
  601. extern void ExecReadyInterpretedExpr(ExprState *state);
  602. extern ExprEvalOp ExecEvalStepOp(ExprState *state, ExprEvalStep *op);
  603. extern Datum ExecInterpExprStillValid(ExprState *state, ExprContext *econtext, bool *isNull);
  604. extern void CheckExprStillValid(ExprState *state, ExprContext *econtext);
  605. /*
  606. * Non fast-path execution functions. These are externs instead of statics in
  607. * execExprInterp.c, because that allows them to be used by other methods of
  608. * expression evaluation, reducing code duplication.
  609. */
  610. extern void ExecEvalFuncExprFusage(ExprState *state, ExprEvalStep *op,
  611. ExprContext *econtext);
  612. extern void ExecEvalFuncExprStrictFusage(ExprState *state, ExprEvalStep *op,
  613. ExprContext *econtext);
  614. extern void ExecEvalParamExec(ExprState *state, ExprEvalStep *op,
  615. ExprContext *econtext);
  616. extern void ExecEvalParamExtern(ExprState *state, ExprEvalStep *op,
  617. ExprContext *econtext);
  618. extern void ExecEvalSQLValueFunction(ExprState *state, ExprEvalStep *op);
  619. extern void ExecEvalCurrentOfExpr(ExprState *state, ExprEvalStep *op);
  620. extern void ExecEvalNextValueExpr(ExprState *state, ExprEvalStep *op);
  621. extern void ExecEvalRowNull(ExprState *state, ExprEvalStep *op,
  622. ExprContext *econtext);
  623. extern void ExecEvalRowNotNull(ExprState *state, ExprEvalStep *op,
  624. ExprContext *econtext);
  625. extern void ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op);
  626. extern void ExecEvalArrayCoerce(ExprState *state, ExprEvalStep *op,
  627. ExprContext *econtext);
  628. extern void ExecEvalRow(ExprState *state, ExprEvalStep *op);
  629. extern void ExecEvalMinMax(ExprState *state, ExprEvalStep *op);
  630. extern void ExecEvalFieldSelect(ExprState *state, ExprEvalStep *op,
  631. ExprContext *econtext);
  632. extern void ExecEvalFieldStoreDeForm(ExprState *state, ExprEvalStep *op,
  633. ExprContext *econtext);
  634. extern void ExecEvalFieldStoreForm(ExprState *state, ExprEvalStep *op,
  635. ExprContext *econtext);
  636. extern bool ExecEvalSubscriptingRef(ExprState *state, ExprEvalStep *op);
  637. extern void ExecEvalSubscriptingRefFetch(ExprState *state, ExprEvalStep *op);
  638. extern void ExecEvalSubscriptingRefOld(ExprState *state, ExprEvalStep *op);
  639. extern void ExecEvalSubscriptingRefAssign(ExprState *state, ExprEvalStep *op);
  640. extern void ExecEvalConvertRowtype(ExprState *state, ExprEvalStep *op,
  641. ExprContext *econtext);
  642. extern void ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op);
  643. extern void ExecEvalConstraintNotNull(ExprState *state, ExprEvalStep *op);
  644. extern void ExecEvalConstraintCheck(ExprState *state, ExprEvalStep *op);
  645. extern void ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op);
  646. extern void ExecEvalGroupingFunc(ExprState *state, ExprEvalStep *op);
  647. extern void ExecEvalSubPlan(ExprState *state, ExprEvalStep *op,
  648. ExprContext *econtext);
  649. extern void ExecEvalAlternativeSubPlan(ExprState *state, ExprEvalStep *op,
  650. ExprContext *econtext);
  651. extern void ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op,
  652. ExprContext *econtext);
  653. extern void ExecEvalSysVar(ExprState *state, ExprEvalStep *op,
  654. ExprContext *econtext, TupleTableSlot *slot);
  655. extern void ExecAggInitGroup(AggState *aggstate, AggStatePerTrans pertrans, AggStatePerGroup pergroup);
  656. extern Datum ExecAggTransReparent(AggState *aggstate, AggStatePerTrans pertrans,
  657. Datum newValue, bool newValueIsNull,
  658. Datum oldValue, bool oldValueIsNull);
  659. extern void ExecEvalAggOrderedTransDatum(ExprState *state, ExprEvalStep *op,
  660. ExprContext *econtext);
  661. extern void ExecEvalAggOrderedTransTuple(ExprState *state, ExprEvalStep *op,
  662. ExprContext *econtext);
  663. #endif /* EXEC_EXPR_H */
上海开阖软件有限公司 沪ICP备12045867号-1