73 Datum *resv,
bool *resnull);
75 Oid funcid,
Oid inputcollid,
79 Datum *resv,
bool *resnull);
89 Datum *resv,
bool *resnull);
93 Datum *resv,
bool *resnull);
97 int transno,
int setno,
int setoff,
bool ishash,
100 Datum *resv,
bool *resnull,
105 Datum *resv,
bool *resnull);
155 state->parent = parent;
156 state->ext_params = NULL;
192 state->parent = NULL;
193 state->ext_params = ext_params;
243 state->parent = parent;
244 state->ext_params = NULL;
276 state->steps_len - 1);
386 state->parent = parent;
387 state->ext_params = NULL;
389 state->resultslot = slot;
395 foreach(lc, targetList)
400 bool isSafeVar =
false;
410 if (tle->
expr != NULL &&
412 ((
Var *) tle->
expr)->varattno > 0)
418 if (inputDesc == NULL)
420 else if (attnum <= inputDesc->natts)
429 if (!attr->attisdropped &&
variable->vartype == attr->atttypid)
574 state->parent = parent;
575 state->ext_params = NULL;
577 state->resultslot = slot;
585 foreach(lc, targetList)
594 elog(
ERROR,
"subplan target list is out of order");
601 elog(
ERROR,
"targetColnos does not match subplan target list");
609 foreach(lc, targetColnos)
653 forboth(lc, targetList, lc2, targetColnos)
664 if (targetattnum <= 0 || targetattnum > relDesc->
natts)
666 (
errcode(ERRCODE_DATATYPE_MISMATCH),
667 errmsg(
"table row type and query-specified row type do not match"),
668 errdetail(
"Query has too many columns.")));
671 if (attr->attisdropped)
673 (
errcode(ERRCODE_DATATYPE_MISMATCH),
674 errmsg(
"table row type and query-specified row type do not match"),
675 errdetail(
"Query provides a value for a dropped column at ordinal position %d.",
679 (
errcode(ERRCODE_DATATYPE_MISMATCH),
680 errmsg(
"table row type and query-specified row type do not match"),
681 errdetail(
"Table has type %s at ordinal position %d, but query expects %s.",
920 Datum *resv,
bool *resnull)
928 Assert(resv != NULL && resnull != NULL);
1052 if (
state->ext_params)
1053 params =
state->ext_params;
1054 else if (
state->parent &&
1055 state->parent->state)
1056 params =
state->parent->state->es_param_list_info;
1073 elog(
ERROR,
"unrecognized paramkind: %d",
1096 elog(
ERROR,
"Aggref found in non-Agg plan node");
1103 case T_GroupingFunc:
1110 elog(
ERROR,
"GroupingFunc found in non-Agg plan node");
1114 agg = (
Agg *) (
state->parent->plan);
1130 wfstate->
wfunc = wfunc;
1156 (
errcode(ERRCODE_WINDOWING_ERROR),
1157 errmsg(
"window function calls cannot be nested")));
1162 elog(
ERROR,
"WindowFunc found in non-WindowAgg plan node");
1171 case T_MergeSupportFunc:
1174 if (!
state->parent ||
1177 elog(
ERROR,
"MergeSupportFunc found in non-merge plan node");
1184 case T_SubscriptingRef:
1208 op->
args, op->opfuncid, op->inputcollid,
1214 case T_DistinctExpr:
1219 op->
args, op->opfuncid, op->inputcollid,
1241 op->
args, op->opfuncid, op->inputcollid,
1266 case T_ScalarArrayOpExpr:
1285 cmpfuncid = opexpr->negfuncid;
1288 cmpfuncid = opexpr->opfuncid;
1320 opexpr->inputcollid, NULL, NULL);
1407 foreach(lc, boolexpr->
args)
1415 switch (boolexpr->
boolop)
1422 else if (off + 1 == nargs)
1432 else if (off + 1 == nargs)
1451 state->steps_len - 1);
1456 foreach(lc, adjust_jumps)
1520 ncolumns = tupDesc->
natts;
1525 nulls = (
bool *)
palloc(
sizeof(
bool) * ncolumns);
1548 Datum *save_innermost_caseval;
1549 bool *save_innermost_casenull;
1551 if (fieldnum <= 0 || fieldnum > ncolumns)
1552 elog(
ERROR,
"field number %d is out of range in FieldStore",
1579 save_innermost_caseval =
state->innermost_caseval;
1580 save_innermost_casenull =
state->innermost_casenull;
1582 state->innermost_casenull = &nulls[fieldnum - 1];
1586 &nulls[fieldnum - 1]);
1588 state->innermost_caseval = save_innermost_caseval;
1589 state->innermost_casenull = save_innermost_casenull;
1631 if (
state->escontext == NULL)
1641 &iofunc, &typisvarlena);
1653 &iofunc, &typioparam);
1676 case T_ArrayCoerceExpr:
1688 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1689 errmsg(
"target type is not an array")));
1743 case T_ConvertRowtypeExpr:
1774 Datum *caseval = NULL;
1775 bool *casenull = NULL;
1783 if (caseExpr->
arg != NULL)
1787 casenull =
palloc(
sizeof(
bool));
1817 foreach(lc, caseExpr->
args)
1820 Datum *save_innermost_caseval;
1821 bool *save_innermost_casenull;
1834 save_innermost_caseval =
state->innermost_caseval;
1835 save_innermost_casenull =
state->innermost_casenull;
1836 state->innermost_caseval = caseval;
1837 state->innermost_casenull = casenull;
1842 state->innermost_caseval = save_innermost_caseval;
1843 state->innermost_casenull = save_innermost_casenull;
1849 whenstep =
state->steps_len - 1;
1867 state->steps_len - 1);
1873 state->steps[whenstep].d.jump.jumpdone =
state->steps_len;
1884 foreach(lc, adjust_jumps)
1896 case T_CaseTestExpr:
1931 (
bool *)
palloc(
sizeof(
bool) * nelems);
1970 if (rowexpr->row_typeid == RECORDOID)
1993 Assert(nelems <= tupdesc->natts);
1994 nelems =
Max(nelems, tupdesc->
natts);
2007 (
bool *)
palloc(
sizeof(
bool) * nelems);
2009 memset(scratch.
d.
row.
elemnulls,
true,
sizeof(
bool) * nelems);
2013 foreach(l, rowexpr->
args)
2018 if (!att->attisdropped)
2028 (
errcode(ERRCODE_DATATYPE_MISMATCH),
2029 errmsg(
"ROW() column has type %s instead of type %s",
2055 case T_RowCompareExpr:
2078 l_right_expr, rcexpr->
rargs,
2079 l_opno, rcexpr->opnos,
2080 l_opfamily, rcexpr->opfamilies,
2081 l_inputcollid, rcexpr->inputcollids)
2104 elog(
ERROR,
"missing support function %d(%u,%u) in opfamily %u",
2113 inputcollid, NULL, NULL);
2138 state->steps_len - 1);
2159 foreach(lc, adjust_jumps)
2176 case T_CoalesceExpr:
2189 foreach(lc, coalesce->
args)
2202 state->steps_len - 1);
2212 foreach(lc, adjust_jumps)
2239 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2240 errmsg(
"could not identify a comparison function for type %s",
2256 minmaxexpr->inputcollid, NULL, NULL);
2263 (
bool *)
palloc(
sizeof(
bool) * nelems);
2272 foreach(lc, minmaxexpr->
args)
2287 case T_SQLValueFunction:
2315 (
bool *)
palloc(
sizeof(
bool) * nnamed);
2328 (
bool *)
palloc(
sizeof(
bool) * nargs);
2364 case T_JsonValueExpr:
2375 case T_JsonConstructorExpr:
2406 jcstate->
nargs = nargs;
2419 jcstate->
arg_values[argno] = con->constvalue;
2420 jcstate->
arg_nulls[argno] = con->constisnull;
2440 for (
int i = 0;
i < nargs;
i++)
2447 &category, &outfuncid);
2459 Datum *innermost_caseval =
state->innermost_caseval;
2460 bool *innermost_isnull =
state->innermost_casenull;
2462 state->innermost_caseval = resv;
2463 state->innermost_casenull = resnull;
2467 state->innermost_caseval = innermost_caseval;
2468 state->innermost_casenull = innermost_isnull;
2473 case T_JsonIsPredicate:
2509 if (ntest->argisrow)
2516 if (ntest->argisrow)
2523 elog(
ERROR,
"unrecognized nulltesttype: %d",
2573 elog(
ERROR,
"unrecognized booltesttype: %d",
2581 case T_CoerceToDomain:
2590 case T_CoerceToDomainValue:
2609 case T_CurrentOfExpr:
2616 case T_NextValueExpr:
2628 case T_ReturningExpr:
2639 retstep =
state->steps_len - 1;
2645 state->steps[retstep].d.returningexpr.jumpdone =
state->steps_len;
2657 elog(
ERROR,
"unrecognized node type: %d",
2720 (
errcode(ERRCODE_TOO_MANY_ARGUMENTS),
2721 errmsg_plural(
"cannot pass more than %d argument to a function",
2722 "cannot pass more than %d arguments to a function",
2738 nargs, inputcollid, NULL, NULL);
2747 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2748 errmsg(
"set-valued function called in context that cannot accept a set"),
2767 fcinfo->
args[argno].
value = con->constvalue;
2768 fcinfo->
args[argno].
isnull = con->constisnull;
2780 if (pgstat_track_functions <= flinfo->fn_stats)
2807 Datum *resv,
bool *resnull)
2815 elog(
ERROR,
"SubPlan found with no parent plan");
2989 switch (
variable->varreturningtype)
3051 bool isfixed =
false;
3123 if (isfixed && desc != NULL && tts_ops != NULL)
3184 case T_SubqueryScanState:
3187 case T_CteScanState:
3196 bool junk_filter_needed =
false;
3206 junk_filter_needed =
true;
3212 if (junk_filter_needed)
3245 (
errcode(ERRCODE_DATATYPE_MISMATCH),
3246 errmsg(
"cannot subscript type %s because it does not support subscripting",
3254 (nupper + nlower) * (
sizeof(
Datum) +
3264 ptr += nupper *
sizeof(
Datum);
3266 ptr += nlower *
sizeof(
Datum);
3268 ptr += nupper *
sizeof(bool);
3270 ptr += nlower *
sizeof(bool);
3272 ptr += nupper *
sizeof(bool);
3282 memset(&methods, 0,
sizeof(methods));
3283 sbsroutines->
exec_setup(sbsref, sbsrefstate, &methods);
3304 state->steps_len - 1);
3362 state->steps_len - 1);
3367 Datum *save_innermost_caseval;
3368 bool *save_innermost_casenull;
3373 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3374 errmsg(
"type %s does not support subscripted assignment",
3395 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3396 errmsg(
"type %s does not support subscripted assignment",
3405 save_innermost_caseval =
state->innermost_caseval;
3406 save_innermost_casenull =
state->innermost_casenull;
3414 state->innermost_caseval = save_innermost_caseval;
3415 state->innermost_casenull = save_innermost_casenull;
3433 foreach(lc, adjust_jumps)
3510 Datum *domainval = NULL;
3511 bool *domainnull = NULL;
3559 Datum *save_innermost_domainval;
3560 bool *save_innermost_domainnull;
3577 (
bool *)
palloc(
sizeof(
bool));
3584 if (domainval == NULL)
3596 domainnull = (
bool *)
palloc(
sizeof(
bool));
3601 scratch2.
resnull = domainnull;
3610 domainnull = resnull;
3620 save_innermost_domainval =
state->innermost_domainval;
3621 save_innermost_domainnull =
state->innermost_domainnull;
3622 state->innermost_domainval = domainval;
3623 state->innermost_domainnull = domainnull;
3630 state->innermost_domainval = save_innermost_domainval;
3631 state->innermost_domainnull = save_innermost_domainnull;
3639 elog(
ERROR,
"unrecognized constraint type: %d",
3662 bool doSort,
bool doHash,
bool nullcheck)
3671 state->parent = parent;
3680 for (
int transno = 0; transno < aggstate->
numtrans; transno++)
3700 for (
int transno = 0; transno < aggstate->
numtrans; transno++)
3706 bool *strictnulls = NULL;
3726 state->steps_len - 1);
3745 strictargs = trans_fcinfo->
args + 1;
3793 state->steps_len - 1);
3812 strictargs = trans_fcinfo->
args + 1;
3850 strictnulls = &
state->resnull;
3865 strictnulls = nulls;
3872 &
values[argno], &nulls[argno]);
3895 state->steps_len - 1);
3910 state->steps_len - 1);
3920 int processGroupingSets =
Max(phase->
numsets, 1);
3923 for (
int setno = 0; setno < processGroupingSets; setno++)
3926 pertrans, transno, setno, setoff,
false,
3943 for (
int setno = 0; setno < numHashes; setno++)
3946 pertrans, transno, setno, setoff,
true,
3953 foreach(
bail, adjust_bailout)
4003 int transno,
int setno,
int setoff,
bool ishash,
4007 int adjust_jumpnull = -1;
4022 adjust_jumpnull =
state->steps_len - 1;
4095 if (adjust_jumpnull != -1)
4135 state->parent = parent;
4142 if ((
int64) numCols + (init_value != 0) > 1)
4146 for (
int i = 0;
i < numCols;
i++)
4147 last_attnum =
Max(last_attnum, keyColIdx[
i]);
4157 if (init_value == 0)
4187 for (
int i = 0;
i < numCols;
i++)
4191 Oid inputcollid = collations[
i];
4194 finfo = &hashfunctions[
i];
4216 if (
i == numCols - 1)
4282 const Oid *hashfunc_oids,
const List *collations,
4283 const List *hash_exprs,
const bool *opstrict,
4292 intptr_t strict_opcode;
4298 state->parent = parent;
4308 if ((
int64) num_exprs + (init_value != 0) > 1)
4311 if (init_value == 0)
4343 forboth(lc, hash_exprs, lc2, collations)
4352 funcid = hashfunc_oids[
i];
4369 if (
i == num_exprs - 1)
4397 scratch.
opcode = opstrict[
i] && !keep_nulls ? strict_opcode : opcode;
4412 foreach(lc, adjust_jumps)
4450 const Oid *eqfunctions,
4451 const Oid *collations,
4469 state->parent = parent;
4475 for (
int natt = 0; natt < numCols; natt++)
4477 int attno = keyColIdx[natt];
4505 for (
int natt = numCols; --natt >= 0;)
4507 int attno = keyColIdx[natt];
4510 Oid foid = eqfunctions[natt];
4566 state->steps_len - 1);
4570 foreach(lc, adjust_jumps)
4608 const Oid *eqfunctions,
4609 const Oid *collations,
4610 const List *param_exprs,
4621 state->parent = parent;
4643 for (
int attno = 0; attno < maxatt; attno++)
4646 Oid foid = eqfunctions[attno];
4702 state->steps_len - 1);
4706 foreach(lc, adjust_jumps)
4730 Datum *resv,
bool *resnull,
4736 List *jumps_return_null =
NIL;
4740 bool returning_domain =
4745 jsestate->
jsexpr = jsexpr;
4808 foreach(lc, jumps_return_null)