50#include "utils/fmgroids.h"
119 bool *haveNull,
bool *forceTrue);
122 bool *haveNull,
bool *forceFalse);
125 Oid result_type,
int32 result_typmod,
126 Oid result_collid,
Oid input_collid,
List **args_p,
127 bool funcvariadic,
bool process_args,
bool allow_non_const,
249 elog(
ERROR,
"WindowFunc contains out-of-range winref %u",
296 if (expr->funcretset)
404 foreach(lc, ctor->
args)
428 if (cnst->constisnull)
680 return (func_id != F_NEXTVAL &&
737 context.max_hazard = PROPARALLEL_SAFE;
738 context.max_interesting = PROPARALLEL_UNSAFE;
764 if (
root->glob->maxParallelHazard == PROPARALLEL_SAFE &&
765 root->glob->paramExecTypes ==
NIL)
768 context.max_hazard = PROPARALLEL_SAFE;
769 context.max_interesting = PROPARALLEL_RESTRICTED;
777 for (proot =
root; proot != NULL; proot = proot->parent_root)
797 case PROPARALLEL_SAFE:
800 case PROPARALLEL_RESTRICTED:
803 context->max_hazard = proparallel;
805 if (
context->max_interesting == proparallel)
808 case PROPARALLEL_UNSAFE:
809 context->max_hazard = proparallel;
813 elog(
ERROR,
"unrecognized proparallel value \"%c\"", proparallel);
904 List *save_safe_param_ids;
909 save_safe_param_ids =
context->safe_param_ids;
915 context->safe_param_ids = save_safe_param_ids;
958 context->max_hazard = PROPARALLEL_UNSAFE;
1185#define CCDN_CASETESTEXPR_OK 0x0001
1205 int save_flags = *flags;
1220 *flags = save_flags;
1235 save_flags = *flags;
1239 *flags = save_flags;
1287 case T_NamedArgExpr:
1292 case T_CaseTestExpr:
1294 case T_SQLValueFunction:
1297 case T_NextValueExpr:
1308 case T_DistinctExpr:
1310 case T_ScalarArrayOpExpr:
1312 case T_ArrayCoerceExpr:
1324 case T_SubscriptingRef:
1344 case T_RowCompareExpr:
1357 larg, rcexpr->
largs,
1358 rarg, rcexpr->
rargs)
1400 case T_CurrentOfExpr:
1486 foreach(l, (
List *) node)
1545 foreach(l, expr->
args)
1739 foreach(l, (
List *) node)
1803 foreach(l, expr->
args)
1938 foreach(l, (
List *) node)
2034 if (expr->
useOr && falseOK)
2039 if (rightop &&
IsA(rightop,
Const))
2041 Datum arraydatum = ((
Const *) rightop)->constvalue;
2042 bool arrayisnull = ((
Const *) rightop)->constisnull;
2057 if (arrayexpr->
elements !=
NIL && !arrayexpr->multidims)
2154 elog(
ERROR,
"cannot commute non-binary-operator clause");
2159 elog(
ERROR,
"could not find commutator for operator %u",
2165 clause->
opno = opoid;
2186 Oid expectedtype,
int32 expectedtypmod,
2187 Oid expectedcollation)
2193 if (rowtypeid == RECORDOID)
2196 if (fieldnum <= 0 || fieldnum > tupdesc->
natts)
2202 if (attr->attisdropped ||
2203 attr->atttypid != expectedtype ||
2204 attr->atttypmod != expectedtypmod ||
2205 attr->attcollation != expectedcollation)
2268#define MIN_ARRAY_SIZE_FOR_HASHED_SAOP 9
2304 if (arrayarg &&
IsA(arrayarg,
Const) &&
2305 !((
Const *) arrayarg)->constisnull)
2310 lefthashfunc == righthashfunc)
2312 Datum arrdatum = ((
Const *) arrayarg)->constvalue;
2326 saop->hashfuncid = lefthashfunc;
2342 lefthashfunc == righthashfunc)
2344 Datum arrdatum = ((
Const *) arrayarg)->constvalue;
2358 saop->hashfuncid = lefthashfunc;
2416#define ece_generic_processing(node) \
2417 expression_tree_mutator((Node *) (node), eval_const_expressions_mutator, \
2425#define ece_all_arguments_const(node) \
2426 (!expression_tree_walker((Node *) (node), contain_non_const_walker, NULL))
2429#define ece_evaluate_expr(node) \
2430 ((Node *) evaluate_expr((Expr *) (node), \
2431 exprType((Node *) (node)), \
2432 exprTypmod((Node *) (node)), \
2433 exprCollation((Node *) (node))))
2500 &typLen, &typByVal);
2501 if (prm->
isnull || typByVal)
2513 return (
Node *) con;
2542 elog(
ERROR,
"cache lookup failed for function %u", funcid);
2545 false, expr->wintype,
2556 aggfilter = (
Expr *)
2563 newexpr->wintype = expr->wintype;
2564 newexpr->wincollid = expr->wincollid;
2565 newexpr->inputcollid = expr->inputcollid;
2568 newexpr->runCondition = expr->runCondition;
2570 newexpr->winstar = expr->winstar;
2571 newexpr->winagg = expr->winagg;
2574 return (
Node *) newexpr;
2591 expr->funcresulttype,
2601 return (
Node *) simple;
2611 newexpr->funcresulttype = expr->funcresulttype;
2612 newexpr->funcretset = expr->funcretset;
2613 newexpr->funcvariadic = expr->funcvariadic;
2614 newexpr->funcformat = expr->funcformat;
2615 newexpr->funccollid = expr->funccollid;
2616 newexpr->inputcollid = expr->inputcollid;
2619 return (
Node *) newexpr;
2639 expr->opresulttype, -1,
2648 return (
Node *) simple;
2655 if (expr->
opno == BooleanEqualOperator ||
2656 expr->
opno == BooleanNotEqualOperator)
2661 return (
Node *) simple;
2671 newexpr->opfuncid = expr->opfuncid;
2672 newexpr->opresulttype = expr->opresulttype;
2673 newexpr->opretset = expr->opretset;
2674 newexpr->opcollid = expr->opcollid;
2675 newexpr->inputcollid = expr->inputcollid;
2678 return (
Node *) newexpr;
2680 case T_DistinctExpr:
2685 bool has_null_input =
false;
2686 bool all_null_input =
true;
2687 bool has_nonconst_input =
false;
2714 has_nonconst_input =
true;
2718 if (!has_nonconst_input)
2743 expr->opresulttype, -1,
2759 csimple->constvalue =
2761 return (
Node *) csimple;
2772 newexpr->opfuncid = expr->opfuncid;
2773 newexpr->opresulttype = expr->opresulttype;
2774 newexpr->opretset = expr->opretset;
2775 newexpr->opcollid = expr->opcollid;
2776 newexpr->inputcollid = expr->inputcollid;
2779 return (
Node *) newexpr;
2785 bool has_nonconst_input =
false;
2794 has_nonconst_input =
true;
2805 if (!has_nonconst_input &&
2809 return (
Node *) expr;
2811 case T_ScalarArrayOpExpr:
2828 return (
Node *) saop;
2839 bool haveNull =
false;
2840 bool forceTrue =
false;
2867 bool haveNull =
false;
2868 bool forceFalse =
false;
2914 case T_JsonValueExpr:
2928 if (formatted_expr &&
IsA(formatted_expr,
Const))
2929 return formatted_expr;
2934 (
Expr *) formatted_expr,
2939 case T_AlternativeSubPlan:
2959 relabel->resulttypmod,
2960 relabel->resultcollid,
2961 relabel->relabelformat,
2970 bool outtypisvarlena;
2989 &outfunc, &outtypisvarlena);
2991 &infunc, &intypioparam);
3035 return (
Node *) simple;
3046 newexpr->resultcollid = expr->resultcollid;
3047 newexpr->coerceformat = expr->coerceformat;
3049 return (
Node *) newexpr;
3051 case T_ArrayCoerceExpr:
3054 Node *save_case_val;
3070 save_case_val =
context->case_val;
3077 context->case_val = save_case_val;
3152 Node *save_case_val;
3155 bool const_true_cond;
3156 Node *defresult = NULL;
3164 save_case_val =
context->case_val;
3175 const_true_cond =
false;
3191 if (casecond &&
IsA(casecond,
Const))
3195 if (const_input->constisnull ||
3199 const_true_cond =
true;
3207 if (!const_true_cond)
3211 newcasewhen->
expr = (
Expr *) casecond;
3214 newargs =
lappend(newargs, newcasewhen);
3223 defresult = caseresult;
3228 if (!const_true_cond)
3232 context->case_val = save_case_val;
3242 newcase->casetype = caseexpr->casetype;
3243 newcase->casecollid = caseexpr->casecollid;
3244 newcase->
arg = (
Expr *) newarg;
3245 newcase->
args = newargs;
3248 return (
Node *) newcase;
3250 case T_CaseTestExpr:
3262 case T_SubscriptingRef:
3289 case T_CoalesceExpr:
3297 foreach(
arg, coalesceexpr->
args)
3314 if (((
Const *)
e)->constisnull)
3331 coalesceexpr->coalescecollid);
3334 newcoalesce->coalescetype = coalesceexpr->coalescetype;
3335 newcoalesce->coalescecollid = coalesceexpr->coalescecollid;
3336 newcoalesce->
args = newargs;
3338 return (
Node *) newcoalesce;
3340 case T_SQLValueFunction:
3391 ((
Var *)
arg)->varlevelsup == 0)
3395 fselect->resulttype,
3396 fselect->resulttypmod,
3397 fselect->resultcollid))
3403 fselect->resulttype,
3404 fselect->resulttypmod,
3405 fselect->resultcollid,
3406 ((
Var *)
arg)->varlevelsup);
3408 newvar->varnullingrels = ((
Var *)
arg)->varnullingrels;
3409 return (
Node *) newvar;
3424 fselect->resulttype,
3425 fselect->resulttypmod,
3426 fselect->resultcollid) &&
3427 fselect->resulttype ==
exprType(fld) &&
3436 newfselect->resulttype = fselect->resulttype;
3437 newfselect->resulttypmod = fselect->resulttypmod;
3438 newfselect->resultcollid = fselect->resultcollid;
3445 newfselect->resulttype,
3446 newfselect->resulttypmod,
3447 newfselect->resultcollid))
3450 return (
Node *) newfselect;
3472 foreach(l, rarg->
args)
3484 if (carg->constisnull ?
3498 newntest->
arg = (
Expr *) relem;
3500 newntest->argisrow =
false;
3502 newargs =
lappend(newargs, newntest);
3521 result = carg->constisnull;
3524 result = !carg->constisnull;
3527 elog(
ERROR,
"unrecognized nulltesttype: %d",
3539 newntest->argisrow = ntest->argisrow;
3541 return (
Node *) newntest;
3566 result = (!carg->constisnull &&
3570 result = (carg->constisnull ||
3574 result = (!carg->constisnull &&
3578 result = (carg->constisnull ||
3582 result = carg->constisnull;
3585 result = !carg->constisnull;
3588 elog(
ERROR,
"unrecognized booltesttype: %d",
3601 return (
Node *) newbtest;
3603 case T_CoerceToDomain:
3632 cdomain->resulttypmod,
3633 cdomain->resultcollid,
3634 cdomain->coercionformat,
3642 newcdomain->resulttypmod = cdomain->resulttypmod;
3643 newcdomain->resultcollid = cdomain->resultcollid;
3644 newcdomain->coercionformat = cdomain->coercionformat;
3646 return (
Node *) newcdomain;
3648 case T_PlaceHolderVar:
3665 case T_ConvertRowtypeExpr:
3676 newcre->convertformat = cre->convertformat;
3702 newcre->convertformat = argcre->convertformat;
3709 return (
Node *) newcre;
3762 if (provolatile == PROVOLATILE_IMMUTABLE)
3764 if (
context->estimate && provolatile == PROVOLATILE_STABLE)
3791 bool *haveNull,
bool *forceTrue)
3794 List *unprocessed_args;
3808 while (unprocessed_args)
3818 List *oldlist = unprocessed_args;
3851 if (const_input->constisnull)
3897 bool *haveNull,
bool *forceFalse)
3900 List *unprocessed_args;
3904 while (unprocessed_args)
3914 List *oldlist = unprocessed_args;
3947 if (const_input->constisnull)
4000 if (opno == BooleanEqualOperator)
4015 if (rightop &&
IsA(rightop,
Const))
4018 if (opno == BooleanEqualOperator)
4059 Oid result_collid,
Oid input_collid,
List **args_p,
4060 bool funcvariadic,
bool process_args,
bool allow_non_const,
4082 elog(
ERROR,
"cache lookup failed for function %u", funcid);
4104 result_collid, input_collid,
4108 if (!newexpr && allow_non_const &&
OidIsValid(func_form->prosupport))
4120 fexpr.
xpr.type = T_FuncExpr;
4122 fexpr.funcresulttype = result_type;
4123 fexpr.funcretset = func_form->proretset;
4124 fexpr.funcvariadic = funcvariadic;
4126 fexpr.funccollid = result_collid;
4127 fexpr.inputcollid = input_collid;
4131 req.
type = T_SupportRequestSimplify;
4143 if (!newexpr && allow_non_const)
4145 input_collid,
args, funcvariadic,
4178 Oid *proargtypes = funcform->proargtypes.values;
4180 bool has_named_args =
false;
4191 if (include_out_arguments)
4193 Datum proallargtypes;
4197 Anum_pg_proc_proallargtypes,
4208 elog(
ERROR,
"proallargtypes is not a 1-D Oid array or it contains nulls");
4221 has_named_args =
true;
4265 elog(
ERROR,
"too many function arguments");
4278 argarray[
i++] =
arg;
4298 i =
pronargs - funcform->pronargdefaults;
4299 foreach(lc, defaults)
4301 if (argarray[
i] == NULL)
4337 elog(
ERROR,
"not enough default arguments");
4352 Datum proargdefaults;
4356 Anum_pg_proc_proargdefaults);
4391 elog(
ERROR,
"too many function arguments");
4398 memcpy(declared_arg_types, proargtypes,
pronargs *
sizeof(
Oid));
4402 funcform->prorettype,
4405 if (rettype != result_type)
4406 elog(
ERROR,
"function's resolved result type changed during planning");
4431 bool has_nonconst_input =
false;
4432 bool has_null_input =
false;
4439 if (funcform->proretset)
4452 if (funcform->prorettype == RECORDOID)
4463 has_nonconst_input =
true;
4472 if (funcform->proisstrict && has_null_input)
4481 if (has_nonconst_input)
4491 if (funcform->provolatile == PROVOLATILE_IMMUTABLE)
4493 else if (
context->estimate && funcform->provolatile == PROVOLATILE_STABLE)
4504 newexpr->
funcid = funcid;
4505 newexpr->funcresulttype = result_type;
4506 newexpr->funcretset =
false;
4507 newexpr->funcvariadic = funcvariadic;
4509 newexpr->funccollid = result_collid;
4510 newexpr->inputcollid = input_collid;
4568 List *raw_parsetree_list;
4569 List *querytree_list;
4580 if (funcform->prolang != SQLlanguageId ||
4581 funcform->prokind != PROKIND_FUNCTION ||
4582 funcform->prosecdef ||
4583 funcform->proretset ||
4584 funcform->prorettype == RECORDOID ||
4617 fexpr->funcresulttype = result_type;
4618 fexpr->funcretset =
false;
4619 fexpr->funcvariadic = funcvariadic;
4621 fexpr->funccollid = result_collid;
4622 fexpr->inputcollid = input_collid;
4635 callback_arg.
prosrc = src;
4638 sqlerrcontext.
arg = &callback_arg;
4645 Anum_pg_proc_prosqlbody,
4740 result_type, rettupdesc,
4763 if (
exprType(newexpr) != result_type)
4774 if (funcform->provolatile == PROVOLATILE_IMMUTABLE &&
4777 else if (funcform->provolatile == PROVOLATILE_STABLE &&
4781 if (funcform->proisstrict &&
4798 usecounts = (
int *)
palloc0(funcform->pronargs *
sizeof(
int));
4808 if (usecounts[
i] == 0)
4811 if (funcform->proisstrict)
4814 else if (usecounts[
i] != 1)
4862 if (
OidIsValid(exprcoll) && exprcoll != result_collid)
4866 newnode->
arg = (
Expr *) newexpr;
4867 newnode->
collOid = result_collid;
4870 newexpr = (
Node *) newnode;
4891 return (
Expr *) newexpr;
4913 context.usecounts = usecounts;
4950 int syntaxerrposition;
4954 if (syntaxerrposition > 0)
4972 Oid result_collation)
4980 bool resultTypByVal;
5027 if (resultTypLen == -1)
5030 const_val =
datumCopy(const_val, resultTypByVal, resultTypLen);
5039 return (
Expr *)
makeConst(result_type, result_typmod, result_collation,
5041 const_val, const_is_null,
5080 List *raw_parsetree_list;
5081 List *querytree_list;
5107 func_oid = fexpr->
funcid;
5114 if (!fexpr->funcretset)
5143 elog(
ERROR,
"cache lookup failed for function %u", func_oid);
5156 if (funcform->prolang != SQLlanguageId ||
5157 funcform->prokind != PROKIND_FUNCTION ||
5158 funcform->proisstrict ||
5159 funcform->provolatile == PROVOLATILE_VOLATILE ||
5160 funcform->prorettype == VOIDOID ||
5161 funcform->prosecdef ||
5162 !funcform->proretset ||
5175 "inline_set_returning_function",
5188 callback_arg.
prosrc = src;
5191 sqlerrcontext.
arg = &callback_arg;
5198 Anum_pg_proc_prosqlbody,
5229 fexpr->inputcollid);
5254 if (rtfunc->funccolnames !=
NIL)
5258 rtfunc->funccoltypes,
5259 rtfunc->funccoltypmods,
5260 rtfunc->funccolcollations);
5286 fexpr->funcresulttype, rettupdesc,
5335 root->glob->dependsOnRole =
true;
Datum querytree(PG_FUNCTION_ARGS)
AclResult object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode)
#define DatumGetArrayTypeP(X)
int ArrayGetNItems(int ndim, const int *dims)
#define InvalidAttrNumber
Bitmapset * bms_make_singleton(int x)
Bitmapset * bms_int_members(Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_del_members(Bitmapset *a, const Bitmapset *b)
void bms_free(Bitmapset *a)
int bms_num_members(const Bitmapset *a)
Bitmapset * bms_add_member(Bitmapset *a, int x)
Bitmapset * bms_add_members(Bitmapset *a, const Bitmapset *b)
BMS_Membership bms_membership(const Bitmapset *a)
Bitmapset * bms_join(Bitmapset *a, Bitmapset *b)
#define TextDatumGetCString(d)
#define Assert(condition)
#define OidIsValid(objectId)
static bool contain_subplans_walker(Node *node, void *context)
#define CCDN_CASETESTEXPR_OK
static List * simplify_or_arguments(List *args, eval_const_expressions_context *context, bool *haveNull, bool *forceTrue)
static bool is_strict_saop(ScalarArrayOpExpr *expr, bool falseOK)
bool contain_volatile_functions_not_nextval(Node *clause)
List * find_forced_null_vars(Node *node)
static bool contain_leaked_vars_checker(Oid func_id, void *context)
static bool rowtype_field_matches(Oid rowtypeid, int fieldnum, Oid expectedtype, int32 expectedtypmod, Oid expectedcollation)
static bool contain_nonstrict_functions_walker(Node *node, void *context)
static List * add_function_defaults(List *args, int pronargs, HeapTuple func_tuple)
#define ece_all_arguments_const(node)
#define ece_evaluate_expr(node)
Query * inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
static bool max_parallel_hazard_checker(Oid func_id, void *context)
static bool max_parallel_hazard_test(char proparallel, max_parallel_hazard_context *context)
bool contain_agg_clause(Node *clause)
static Node * substitute_actual_srf_parameters_mutator(Node *node, substitute_actual_srf_parameters_context *context)
static bool contain_agg_clause_walker(Node *node, void *context)
static bool contain_nonstrict_functions_checker(Oid func_id, void *context)
int NumRelids(PlannerInfo *root, Node *clause)
bool contain_mutable_functions(Node *clause)
bool is_pseudo_constant_clause(Node *clause)
static bool max_parallel_hazard_walker(Node *node, max_parallel_hazard_context *context)
bool contain_window_function(Node *clause)
#define ece_generic_processing(node)
Node * estimate_expression_value(PlannerInfo *root, Node *node)
static Expr * evaluate_function(Oid funcid, Oid result_type, int32 result_typmod, Oid result_collid, Oid input_collid, List *args, bool funcvariadic, HeapTuple func_tuple, eval_const_expressions_context *context)
static Node * substitute_actual_parameters_mutator(Node *node, substitute_actual_parameters_context *context)
static bool contain_mutable_functions_checker(Oid func_id, void *context)
Var * find_forced_null_var(Node *node)
bool is_pseudo_constant_clause_relids(Node *clause, Relids relids)
static Query * substitute_actual_srf_parameters(Query *expr, int nargs, List *args)
static bool ece_function_is_safe(Oid funcid, eval_const_expressions_context *context)
static bool contain_volatile_functions_checker(Oid func_id, void *context)
static List * simplify_and_arguments(List *args, eval_const_expressions_context *context, bool *haveNull, bool *forceFalse)
WindowFuncLists * find_window_functions(Node *clause, Index maxWinRef)
static Expr * simplify_function(Oid funcid, Oid result_type, int32 result_typmod, Oid result_collid, Oid input_collid, List **args_p, bool funcvariadic, bool process_args, bool allow_non_const, eval_const_expressions_context *context)
Node * eval_const_expressions(PlannerInfo *root, Node *node)
bool contain_volatile_functions_after_planning(Expr *expr)
static Expr * inline_function(Oid funcid, Oid result_type, Oid result_collid, Oid input_collid, List *args, bool funcvariadic, HeapTuple func_tuple, eval_const_expressions_context *context)
static List * reorder_function_arguments(List *args, int pronargs, HeapTuple func_tuple)
static Node * substitute_actual_parameters(Node *expr, int nargs, List *args, int *usecounts)
static bool contain_mutable_functions_walker(Node *node, void *context)
bool contain_mutable_functions_after_planning(Expr *expr)
static bool contain_volatile_functions_walker(Node *node, void *context)
bool contain_leaked_vars(Node *clause)
List * find_nonnullable_vars(Node *clause)
static Relids find_nonnullable_rels_walker(Node *node, bool top_level)
void convert_saop_to_hashed_saop(Node *node)
static void sql_inline_error_callback(void *arg)
static bool contain_volatile_functions_not_nextval_walker(Node *node, void *context)
static bool contain_leaked_vars_walker(Node *node, void *context)
static bool contain_non_const_walker(Node *node, void *context)
static bool contain_context_dependent_node(Node *clause)
Relids find_nonnullable_rels(Node *clause)
static void recheck_cast_function_args(List *args, Oid result_type, Oid *proargtypes, int pronargs, HeapTuple func_tuple)
static bool find_window_functions_walker(Node *node, WindowFuncLists *lists)
List * expand_function_arguments(List *args, bool include_out_arguments, Oid result_type, HeapTuple func_tuple)
char max_parallel_hazard(Query *parse)
bool is_parallel_safe(PlannerInfo *root, Node *node)
bool contain_nonstrict_functions(Node *clause)
static bool contain_volatile_functions_not_nextval_checker(Oid func_id, void *context)
static List * find_nonnullable_vars_walker(Node *node, bool top_level)
bool contain_subplans(Node *clause)
static Node * simplify_boolean_equality(Oid opno, List *args)
static bool contain_exec_param_walker(Node *node, List *param_ids)
Bitmapset * pull_paramids(Expr *expr)
void CommuteOpExpr(OpExpr *clause)
static Node * eval_const_expressions_mutator(Node *node, eval_const_expressions_context *context)
static bool pull_paramids_walker(Node *node, Bitmapset **context)
Expr * evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod, Oid result_collation)
static bool convert_saop_to_hashed_saop_walker(Node *node, void *context)
static List * fetch_function_defaults(HeapTuple func_tuple)
bool contain_volatile_functions(Node *clause)
double expression_returns_set_rows(PlannerInfo *root, Node *clause)
static bool contain_context_dependent_node_walker(Node *node, int *flags)
bool contain_exec_param(Node *clause, List *param_ids)
#define MIN_ARRAY_SIZE_FOR_HASHED_SAOP
void cost_qual_eval(QualCost *cost, List *quals, PlannerInfo *root)
double clamp_row_est(double nrows)
Datum datumCopy(Datum value, bool typByVal, int typLen)
static void PGresult * res
int internalerrquery(const char *query)
int internalerrposition(int cursorpos)
ErrorContextCallback * error_context_stack
int errposition(int cursorpos)
ExprState * ExecInitExpr(Expr *node, PlanState *parent)
void FreeExecutorState(EState *estate)
EState * CreateExecutorState(void)
#define GetPerTupleExprContext(estate)
static Datum ExecEvalExprSwitchContext(ExprState *state, ExprContext *econtext, bool *isNull)
#define OidFunctionCall1(functionId, arg1)
#define PG_DETOAST_DATUM_COPY(datum)
#define FmgrHookIsNeeded(fn_oid)
TypeFuncClass get_expr_result_type(Node *expr, Oid *resultTypeId, TupleDesc *resultTupleDesc)
@ TYPEFUNC_COMPOSITE_DOMAIN
void sql_fn_parser_setup(struct ParseState *pstate, SQLFunctionParseInfoPtr pinfo)
bool check_sql_fn_retval(List *queryTreeLists, Oid rettype, TupleDesc rettupdesc, char prokind, bool insertDroppedCols, List **resultTargetList)
SQLFunctionParseInfoPtr prepare_sql_fn_parse_info(HeapTuple procedureTuple, Node *call_expr, Oid inputCollation)
bool heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc)
#define HeapTupleIsValid(tuple)
if(TABLE==NULL||TABLE_index==NULL)
bool to_json_is_immutable(Oid typoid)
bool to_jsonb_is_immutable(Oid typoid)
bool jspIsMutable(JsonPath *path, List *varnames, List *varexprs)
static JsonPath * DatumGetJsonPathP(Datum d)
List * lappend(List *list, void *datum)
List * list_delete_first(List *list)
List * list_concat(List *list1, const List *list2)
List * list_concat_copy(const List *list1, const List *list2)
List * list_copy(const List *oldlist)
List * lappend_oid(List *list, Oid datum)
List * list_delete_last(List *list)
void list_free(List *list)
bool list_member_int(const List *list, int datum)
bool list_member_oid(const List *list, Oid datum)
List * list_delete_first_n(List *list, int n)
bool list_member(const List *list, const void *datum)
char func_parallel(Oid funcid)
void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena)
void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval)
RegProcedure get_opcode(Oid opno)
void getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam)
char func_volatile(Oid funcid)
bool func_strict(Oid funcid)
bool get_func_leakproof(Oid funcid)
const struct SubscriptRoutines * getSubscriptingRoutines(Oid typid, Oid *typelemp)
bool get_op_hash_functions(Oid opno, RegProcedure *lhs_procno, RegProcedure *rhs_procno)
Oid get_negator(Oid opno)
Oid get_commutator(Oid opno)
Expr * make_orclause(List *orclauses)
Var * makeVar(int varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup)
Const * makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid)
Node * makeBoolConst(bool value, bool isnull)
Expr * make_andclause(List *andclauses)
JsonValueExpr * makeJsonValueExpr(Expr *raw_expr, Expr *formatted_expr, JsonFormat *format)
Const * makeConst(Oid consttype, int32 consttypmod, Oid constcollid, int constlen, Datum constvalue, bool constisnull, bool constbyval)
void pfree(void *pointer)
void * palloc0(Size size)
MemoryContext CurrentMemoryContext
void MemoryContextDelete(MemoryContext context)
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
List * mbms_add_members(List *a, const List *b)
List * mbms_add_member(List *a, int listidx, int bitidx)
List * mbms_int_members(List *a, const List *b)
Oid exprType(const Node *expr)
int32 exprTypmod(const Node *expr)
bool check_functions_in_node(Node *node, check_function_callback checker, void *context)
Oid exprCollation(const Node *expr)
Node * applyRelabelType(Node *arg, Oid rtype, int32 rtypmod, Oid rcollid, CoercionForm rformat, int rlocation, bool overwrite_ok)
void fix_opfuncids(Node *node)
void set_sa_opfuncid(ScalarArrayOpExpr *opexpr)
void set_opfuncid(OpExpr *opexpr)
#define expression_tree_mutator(n, m, c)
static bool is_andclause(const void *clause)
static bool is_orclause(const void *clause)
#define query_tree_walker(q, w, c, f)
static bool is_opclause(const void *clause)
#define expression_tree_walker(n, w, c)
#define query_tree_mutator(q, m, c, f)
#define IsA(nodeptr, _type_)
#define castNode(_type_, nodeptr)
void(* ParserSetupHook)(struct ParseState *pstate, void *arg)
Oid enforce_generic_type_consistency(const Oid *actual_arg_types, Oid *declared_arg_types, int nargs, Oid rettype, bool allow_poly)
void make_fn_arguments(ParseState *pstate, List *fargs, Oid *actual_arg_types, Oid *declared_arg_types)
void free_parsestate(ParseState *pstate)
ParseState * make_parsestate(ParseState *parentParseState)
Query * transformTopLevelStmt(ParseState *pstate, RawStmt *parseTree)
FormData_pg_attribute * Form_pg_attribute
#define lfirst_node(type, lc)
static int list_length(const List *l)
#define linitial_node(type, l)
#define forthree(cell1, list1, cell2, list2, cell3, list3)
static void * list_nth(const List *list, int n)
#define list_make3(x1, x2, x3)
FormData_pg_proc * Form_pg_proc
double get_function_rows(PlannerInfo *root, Oid funcid, Node *node)
Expr * expression_planner(Expr *expr)
List * pg_analyze_and_rewrite_withcb(RawStmt *parsetree, const char *query_string, ParserSetupHook parserSetup, void *parserSetupArg, QueryEnvironment *queryEnv)
List * pg_parse_query(const char *query_string)
List * pg_rewrite_query(Query *query)
static bool DatumGetBool(Datum X)
static Datum PointerGetDatum(const void *X)
static Datum BoolGetDatum(bool X)
static Datum ObjectIdGetDatum(Oid X)
static Pointer DatumGetPointer(Datum X)
static Datum Int32GetDatum(int32 X)
Node * negate_clause(Node *node)
MemoryContextSwitchTo(old_ctx)
void * stringToNode(const char *str)
static struct subre * parse(struct vars *v, int stopper, int type, struct state *init, struct state *final)
void AcquireRewriteLocks(Query *parsetree, bool forExecute, bool forUpdatePushedDown)
bool contain_windowfuncs(Node *node)
void IncrementVarSublevelsUp(Node *node, int delta_sublevels_up, int min_sublevels_up)
void record_plan_type_dependency(PlannerInfo *root, Oid typid)
void record_plan_function_dependency(PlannerInfo *root, Oid funcid)
void check_stack_depth(void)
BoolTestType booltesttype
MemoryContext es_query_cxt
struct ErrorContextCallback * previous
void(* callback)(void *arg)
JsonReturning * returning
NullTestType nulltesttype
ParamExternData params[FLEXIBLE_ARRAY_MEMBER]
ParamFetchHook paramFetch
const char * p_sourcetext
VolatileFunctionStatus has_volatile_expr
struct PlannerInfo * root
ParamListInfo boundParams
#define FirstLowInvalidHeapAttributeNumber
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
Datum SysCacheGetAttrNotNull(int cacheId, HeapTuple tup, AttrNumber attributeNumber)
TupleDesc BuildDescFromLists(const List *names, const List *types, const List *typmods, const List *collations)
#define ReleaseTupleDesc(tupdesc)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
TupleDesc lookup_rowtype_tupdesc_domain(Oid type_id, int32 typmod, bool noError)
bool DomainHasConstraints(Oid type_id)
TypeCacheEntry * lookup_type_cache(Oid type_id, int flags)
#define TYPECACHE_CMP_PROC
bool contain_var_clause(Node *node)
Relids pull_varnos(PlannerInfo *root, Node *node)