87 #ifdef HAVE_COMPUTED_GOTO
88 #define EEO_USE_COMPUTED_GOTO
101 #if defined(EEO_USE_COMPUTED_GOTO)
104 typedef struct ExprEvalOpLookup
111 static const void **dispatch_table = NULL;
114 static ExprEvalOpLookup reverse_dispatch_table[
EEOP_LAST];
117 #define EEO_CASE(name) CASE_##name:
118 #define EEO_DISPATCH() goto *((void *) op->opcode)
119 #define EEO_OPCODE(opcode) ((intptr_t) dispatch_table[opcode])
123 #define EEO_SWITCH() starteval: switch ((ExprEvalOp) op->opcode)
124 #define EEO_CASE(name) case name:
125 #define EEO_DISPATCH() goto starteval
126 #define EEO_OPCODE(opcode) (opcode)
136 #define EEO_JUMP(stepno) \
138 op = &state->steps[stepno]; \
194 #define SH_PREFIX saophash
195 #define SH_ELEMENT_TYPE ScalarArrayOpExprHashEntry
196 #define SH_KEY_TYPE Datum
197 #define SH_SCOPE static inline
218 #define SH_PREFIX saophash
219 #define SH_ELEMENT_TYPE ScalarArrayOpExprHashEntry
220 #define SH_KEY_TYPE Datum
222 #define SH_HASH_KEY(tb, key) saop_element_hash(tb, key)
223 #define SH_EQUAL(tb, a, b) saop_hash_element_match(tb, a, b)
224 #define SH_SCOPE static inline
225 #define SH_STORE_HASH
226 #define SH_GET_HASH(tb, a) a->hash
274 if (
state->steps_len == 3)
317 state->steps[0].d.casetest.value)
323 else if (
state->steps_len == 2)
364 #if defined(EEO_USE_COMPUTED_GOTO)
370 for (
int off = 0; off <
state->steps_len; off++)
405 #if defined(EEO_USE_COMPUTED_GOTO)
406 static const void *
const dispatch_table[] = {
408 &&CASE_EEOP_INNER_FETCHSOME,
409 &&CASE_EEOP_OUTER_FETCHSOME,
410 &&CASE_EEOP_SCAN_FETCHSOME,
411 &&CASE_EEOP_INNER_VAR,
412 &&CASE_EEOP_OUTER_VAR,
413 &&CASE_EEOP_SCAN_VAR,
414 &&CASE_EEOP_INNER_SYSVAR,
415 &&CASE_EEOP_OUTER_SYSVAR,
416 &&CASE_EEOP_SCAN_SYSVAR,
417 &&CASE_EEOP_WHOLEROW,
418 &&CASE_EEOP_ASSIGN_INNER_VAR,
419 &&CASE_EEOP_ASSIGN_OUTER_VAR,
420 &&CASE_EEOP_ASSIGN_SCAN_VAR,
421 &&CASE_EEOP_ASSIGN_TMP,
422 &&CASE_EEOP_ASSIGN_TMP_MAKE_RO,
424 &&CASE_EEOP_FUNCEXPR,
425 &&CASE_EEOP_FUNCEXPR_STRICT,
426 &&CASE_EEOP_FUNCEXPR_FUSAGE,
427 &&CASE_EEOP_FUNCEXPR_STRICT_FUSAGE,
428 &&CASE_EEOP_BOOL_AND_STEP_FIRST,
429 &&CASE_EEOP_BOOL_AND_STEP,
430 &&CASE_EEOP_BOOL_AND_STEP_LAST,
431 &&CASE_EEOP_BOOL_OR_STEP_FIRST,
432 &&CASE_EEOP_BOOL_OR_STEP,
433 &&CASE_EEOP_BOOL_OR_STEP_LAST,
434 &&CASE_EEOP_BOOL_NOT_STEP,
437 &&CASE_EEOP_JUMP_IF_NULL,
438 &&CASE_EEOP_JUMP_IF_NOT_NULL,
439 &&CASE_EEOP_JUMP_IF_NOT_TRUE,
440 &&CASE_EEOP_NULLTEST_ISNULL,
441 &&CASE_EEOP_NULLTEST_ISNOTNULL,
442 &&CASE_EEOP_NULLTEST_ROWISNULL,
443 &&CASE_EEOP_NULLTEST_ROWISNOTNULL,
444 &&CASE_EEOP_BOOLTEST_IS_TRUE,
445 &&CASE_EEOP_BOOLTEST_IS_NOT_TRUE,
446 &&CASE_EEOP_BOOLTEST_IS_FALSE,
447 &&CASE_EEOP_BOOLTEST_IS_NOT_FALSE,
448 &&CASE_EEOP_PARAM_EXEC,
449 &&CASE_EEOP_PARAM_EXTERN,
450 &&CASE_EEOP_PARAM_CALLBACK,
451 &&CASE_EEOP_CASE_TESTVAL,
452 &&CASE_EEOP_MAKE_READONLY,
453 &&CASE_EEOP_IOCOERCE,
454 &&CASE_EEOP_DISTINCT,
455 &&CASE_EEOP_NOT_DISTINCT,
457 &&CASE_EEOP_CURRENTOFEXPR,
458 &&CASE_EEOP_NEXTVALUEEXPR,
459 &&CASE_EEOP_ARRAYEXPR,
460 &&CASE_EEOP_ARRAYCOERCE,
462 &&CASE_EEOP_ROWCOMPARE_STEP,
463 &&CASE_EEOP_ROWCOMPARE_FINAL,
465 &&CASE_EEOP_FIELDSELECT,
466 &&CASE_EEOP_FIELDSTORE_DEFORM,
467 &&CASE_EEOP_FIELDSTORE_FORM,
468 &&CASE_EEOP_SBSREF_SUBSCRIPTS,
469 &&CASE_EEOP_SBSREF_OLD,
470 &&CASE_EEOP_SBSREF_ASSIGN,
471 &&CASE_EEOP_SBSREF_FETCH,
472 &&CASE_EEOP_DOMAIN_TESTVAL,
473 &&CASE_EEOP_DOMAIN_NOTNULL,
474 &&CASE_EEOP_DOMAIN_CHECK,
475 &&CASE_EEOP_CONVERT_ROWTYPE,
476 &&CASE_EEOP_SCALARARRAYOP,
477 &&CASE_EEOP_HASHED_SCALARARRAYOP,
479 &&CASE_EEOP_JSON_CONSTRUCTOR,
481 &&CASE_EEOP_GROUPING_FUNC,
482 &&CASE_EEOP_WINDOW_FUNC,
484 &&CASE_EEOP_AGG_STRICT_DESERIALIZE,
485 &&CASE_EEOP_AGG_DESERIALIZE,
486 &&CASE_EEOP_AGG_STRICT_INPUT_CHECK_ARGS,
487 &&CASE_EEOP_AGG_STRICT_INPUT_CHECK_NULLS,
488 &&CASE_EEOP_AGG_PLAIN_PERGROUP_NULLCHECK,
489 &&CASE_EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYVAL,
490 &&CASE_EEOP_AGG_PLAIN_TRANS_STRICT_BYVAL,
491 &&CASE_EEOP_AGG_PLAIN_TRANS_BYVAL,
492 &&CASE_EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYREF,
493 &&CASE_EEOP_AGG_PLAIN_TRANS_STRICT_BYREF,
494 &&CASE_EEOP_AGG_PLAIN_TRANS_BYREF,
495 &&CASE_EEOP_AGG_PRESORTED_DISTINCT_SINGLE,
496 &&CASE_EEOP_AGG_PRESORTED_DISTINCT_MULTI,
497 &&CASE_EEOP_AGG_ORDERED_TRANS_DATUM,
498 &&CASE_EEOP_AGG_ORDERED_TRANS_TUPLE,
503 "dispatch_table out of whack with ExprEvalOp");
513 resultslot =
state->resultslot;
518 #if defined(EEO_USE_COMPUTED_GOTO)
628 int attnum =
op->d.assign_var.attnum;
635 Assert(
resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);
645 int attnum =
op->d.assign_var.attnum;
652 Assert(
resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);
662 int attnum =
op->d.assign_var.attnum;
669 Assert(
resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);
680 Assert(
resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);
691 Assert(
resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);
704 *
op->resnull =
op->d.constval.isnull;
705 *
op->resvalue =
op->d.constval.value;
731 d =
op->d.func.fn_addr(fcinfo);
746 for (
int argno = 0; argno <
nargs; argno++)
755 d =
op->d.func.fn_addr(fcinfo);
791 *
op->d.boolexpr.anynull =
false;
805 *
op->d.boolexpr.anynull =
true;
833 else if (*
op->d.boolexpr.anynull)
858 *
op->d.boolexpr.anynull =
false;
872 *
op->d.boolexpr.anynull =
true;
900 else if (*
op->d.boolexpr.anynull)
935 *
op->resnull =
false;
984 *
op->resnull =
false;
992 *
op->resnull =
false;
1020 *
op->resnull =
false;
1032 *
op->resnull =
false;
1045 *
op->resnull =
false;
1058 *
op->resnull =
false;
1083 op->d.cparam.paramfunc(
state,
op, econtext);
1098 if (
op->d.casetest.value)
1100 *
op->resvalue = *
op->d.casetest.value;
1101 *
op->resnull = *
op->d.casetest.isnull;
1117 if (
op->d.casetest.value)
1119 *
op->resvalue = *
op->d.casetest.value;
1120 *
op->resnull = *
op->d.casetest.isnull;
1136 if (!*
op->d.make_readonly.isnull)
1139 *
op->resnull = *
op->d.make_readonly.isnull;
1163 fcinfo_out =
op->d.iocoerce.fcinfo_data_out;
1167 fcinfo_out->
isnull =
false;
1175 if (!
op->d.iocoerce.finfo_in->fn_strict ||
str != NULL)
1180 fcinfo_in =
op->d.iocoerce.fcinfo_data_in;
1185 fcinfo_in->
isnull =
false;
1223 *
op->resnull =
false;
1229 *
op->resnull =
false;
1237 eqresult =
op->d.func.fn_addr(fcinfo);
1254 *
op->resnull =
false;
1259 *
op->resnull =
false;
1266 eqresult =
op->d.func.fn_addr(fcinfo);
1267 *
op->resvalue = eqresult;
1287 result =
op->d.func.fn_addr(fcinfo);
1293 *
op->resnull =
true;
1355 if (
op->d.rowcompare_step.finfo->fn_strict &&
1358 *
op->resnull =
true;
1364 d =
op->d.rowcompare_step.fn_addr(fcinfo);
1370 *
op->resnull =
true;
1373 *
op->resnull =
false;
1389 *
op->resnull =
false;
1448 if (
op->d.sbsref_subscript.subscriptfunc(
state,
op, econtext))
1464 op->d.sbsref.subscriptfunc(
state,
op, econtext);
1530 int aggno =
op->d.aggref.aggno;
1575 if (
op->d.agg_deserialize.fcinfo_data->args[0].isnull)
1609 int nargs =
op->d.agg_strict_input_check.nargs;
1611 for (
int argno = 0; argno <
nargs; argno++)
1614 EEO_JUMP(
op->d.agg_strict_input_check.jumpnull);
1621 bool *
nulls =
op->d.agg_strict_input_check.nulls;
1622 int nargs =
op->d.agg_strict_input_check.nargs;
1624 for (
int argno = 0; argno <
nargs; argno++)
1627 EEO_JUMP(
op->d.agg_strict_input_check.jumpnull);
1642 if (pergroup_allaggs == NULL)
1643 EEO_JUMP(
op->d.agg_plain_pergroup_nullcheck.jumpnull);
1673 op->d.agg_trans.aggcontext);
1680 op->d.agg_trans.aggcontext,
1681 op->d.agg_trans.setno);
1699 op->d.agg_trans.aggcontext,
1700 op->d.agg_trans.setno);
1716 op->d.agg_trans.aggcontext,
1717 op->d.agg_trans.setno);
1734 op->d.agg_trans.aggcontext);
1737 op->d.agg_trans.aggcontext,
1738 op->d.agg_trans.setno);
1755 op->d.agg_trans.aggcontext,
1756 op->d.agg_trans.setno);
1771 op->d.agg_trans.aggcontext,
1772 op->d.agg_trans.setno);
1785 EEO_JUMP(
op->d.agg_presorted_distinctcheck.jumpdistinct);
1796 EEO_JUMP(
op->d.agg_presorted_distinctcheck.jumpdistinct);
1827 return state->resvalue;
1848 return state->evalfunc(
state, econtext, isNull);
1866 for (
int i = 0;
i <
state->steps_len;
i++)
1932 elog(
ERROR,
"attribute number %d exceeds number of columns %d",
1937 if (attr->attisdropped)
1939 (
errcode(ERRCODE_UNDEFINED_COLUMN),
1940 errmsg(
"attribute %d of type %s has been dropped",
1943 if (
vartype != attr->atttypid)
1945 (
errcode(ERRCODE_DATATYPE_MISMATCH),
1946 errmsg(
"attribute %d of type %s has wrong type",
1948 errdetail(
"Table has type %s, but query expects %s.",
1960 #ifdef USE_ASSERT_CHECKING
1962 if (!
op->d.fetch.fixed)
2008 if (type_id != RECORDOID)
2024 if (typentry->
tupDesc == NULL)
2026 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2027 errmsg(
"type %s is not composite",
2111 int attnum =
op->d.assign_var.attnum + 1;
2126 Assert(
resultnum >= 0 && resultnum < outslot->tts_tupleDescriptor->natts);
2167 *
op->resvalue = *
op->d.casetest.value;
2168 *
op->resnull = *
op->d.casetest.isnull;
2173 fcinfo =
op->d.func.fcinfo_data;
2177 for (
int argno = 0; argno <
nargs; argno++)
2186 d =
op->d.func.fn_addr(fcinfo);
2198 return op->d.constval.value;
2249 int attnum =
op->d.assign_var.attnum;
2258 Assert(
resultnum >= 0 && resultnum < outslot->tts_tupleDescriptor->natts);
2287 #if defined(EEO_USE_COMPUTED_GOTO)
2293 dispatch_compare_ptr(
const void *
a,
const void *
b)
2295 const ExprEvalOpLookup *la = (
const ExprEvalOpLookup *)
a;
2296 const ExprEvalOpLookup *lb = (
const ExprEvalOpLookup *)
b;
2298 if (la->opcode < lb->opcode)
2300 else if (la->opcode > lb->opcode)
2312 #if defined(EEO_USE_COMPUTED_GOTO)
2314 if (dispatch_table == NULL)
2316 dispatch_table = (
const void **)
2322 reverse_dispatch_table[
i].opcode = dispatch_table[
i];
2327 qsort(reverse_dispatch_table,
2329 sizeof(ExprEvalOpLookup),
2330 dispatch_compare_ptr);
2344 #if defined(EEO_USE_COMPUTED_GOTO)
2347 ExprEvalOpLookup
key;
2348 ExprEvalOpLookup *
res;
2350 key.opcode = (
void *)
op->opcode;
2352 reverse_dispatch_table,
2354 sizeof(ExprEvalOpLookup),
2355 dispatch_compare_ptr);
2382 d =
op->d.func.fn_addr(fcinfo);
2404 for (
int argno = 0; argno <
nargs; argno++)
2408 *
op->resnull =
true;
2416 d =
op->d.func.fn_addr(fcinfo);
2455 int paramId =
op->d.param.paramid;
2458 paramId > 0 && paramId <= paramInfo->numParams))
2465 prm = paramInfo->
paramFetch(paramInfo, paramId,
false, &prmdata);
2467 prm = ¶mInfo->
params[paramId - 1];
2474 (
errcode(ERRCODE_DATATYPE_MISMATCH),
2475 errmsg(
"type of parameter %d (%s) does not match that when preparing the plan (%s)",
2486 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2487 errmsg(
"no value found for parameter %d", paramId)));
2503 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2504 errmsg(
"WHERE CURRENT OF is not supported for this table type")));
2515 switch (
op->d.nextvalueexpr.seqtypid)
2527 elog(
ERROR,
"unsupported sequence type %u",
2528 op->d.nextvalueexpr.seqtypid);
2530 *
op->resnull =
false;
2564 *
op->resnull =
false;
2596 &
op->d.nulltest_row.rowcache, NULL);
2604 for (
int att = 1; att <= tupDesc->
natts; att++)
2643 int nelems =
op->d.arrayexpr.nelems;
2649 *
op->resnull =
false;
2651 if (!
op->d.arrayexpr.multidims)
2654 Datum *dvalues =
op->d.arrayexpr.elemvalues;
2655 bool *dnulls =
op->d.arrayexpr.elemnulls;
2664 op->d.arrayexpr.elemlength,
2665 op->d.arrayexpr.elembyval,
2666 op->d.arrayexpr.elemalign);
2673 int outer_nelems = 0;
2675 int *elem_dims = NULL;
2676 int *elem_lbs = NULL;
2677 bool firstone =
true;
2678 bool havenulls =
false;
2679 bool haveempty =
false;
2694 for (
int elemoff = 0; elemoff <
nelems; elemoff++)
2701 arraydatum =
op->d.arrayexpr.elemvalues[elemoff];
2702 eisnull =
op->d.arrayexpr.elemnulls[elemoff];
2716 (
errcode(ERRCODE_DATATYPE_MISMATCH),
2717 errmsg(
"cannot merge incompatible arrays"),
2718 errdetail(
"Array with element type %s cannot be "
2719 "included in ARRAY construct with element type %s.",
2725 if (this_ndims <= 0)
2734 elem_ndims = this_ndims;
2735 ndims = elem_ndims + 1;
2736 if (ndims <= 0 || ndims >
MAXDIM)
2738 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
2739 errmsg(
"number of array dimensions (%d) exceeds the maximum allowed (%d)",
2742 elem_dims = (
int *)
palloc(elem_ndims *
sizeof(
int));
2743 memcpy(elem_dims,
ARR_DIMS(array), elem_ndims *
sizeof(
int));
2744 elem_lbs = (
int *)
palloc(elem_ndims *
sizeof(
int));
2745 memcpy(elem_lbs,
ARR_LBOUND(array), elem_ndims *
sizeof(
int));
2752 if (elem_ndims != this_ndims ||
2754 elem_ndims *
sizeof(
int)) != 0 ||
2756 elem_ndims *
sizeof(
int)) != 0)
2758 (
errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
2759 errmsg(
"multidimensional arrays must have array "
2760 "expressions with matching dimensions")));
2766 nbytes += subbytes[outer_nelems];
2770 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
2771 errmsg(
"array size exceeds the maximum allowed (%d)",
2793 (
errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
2794 errmsg(
"multidimensional arrays must have array "
2795 "expressions with matching dimensions")));
2799 dims[0] = outer_nelems;
2801 for (
int i = 1;
i < ndims;
i++)
2803 dims[
i] = elem_dims[
i - 1];
2804 lbs[
i] = elem_lbs[
i - 1];
2814 nbytes += dataoffset;
2824 result->
ndim = ndims;
2827 memcpy(
ARR_DIMS(result), dims, ndims *
sizeof(
int));
2828 memcpy(
ARR_LBOUND(result), lbs, ndims *
sizeof(
int));
2832 for (
int i = 0;
i < outer_nelems;
i++)
2834 memcpy(dat, subdata[
i], subbytes[
i]);
2840 iitem += subnitems[
i];
2861 arraydatum = *
op->resvalue;
2867 if (
op->d.arraycoerce.elemexprstate == NULL)
2881 op->d.arraycoerce.elemexprstate,
2883 op->d.arraycoerce.resultelemtype,
2884 op->d.arraycoerce.amstate);
2900 op->d.row.elemvalues,
2901 op->d.row.elemnulls);
2904 *
op->resnull =
false;
2917 bool *
nulls =
op->d.minmax.nulls;
2926 *
op->resnull =
true;
2928 for (
int off = 0; off <
op->d.minmax.nelems; off++)
2938 *
op->resnull =
false;
2953 if (cmpresult > 0 &&
operator ==
IS_LEAST)
2955 else if (cmpresult < 0 &&
operator ==
IS_GREATEST)
2982 tupDatum = *
op->resvalue;
3000 elog(
ERROR,
"unsupported reference to system column %d in FieldSelect",
3003 elog(
ERROR,
"attribute number %d exceeds number of columns %d",
3008 if (attr->attisdropped)
3010 *
op->resnull =
true;
3016 if (
op->d.fieldselect.resulttype != attr->atttypid)
3018 (
errcode(ERRCODE_DATATYPE_MISMATCH),
3020 errdetail(
"Table has type %s, but query expects %s.",
3038 &
op->d.fieldselect.rowcache, NULL);
3046 elog(
ERROR,
"unsupported reference to system column %d in FieldSelect",
3049 elog(
ERROR,
"attribute number %d exceeds number of columns %d",
3054 if (attr->attisdropped)
3056 *
op->resnull =
true;
3062 if (
op->d.fieldselect.resulttype != attr->atttypid)
3064 (
errcode(ERRCODE_DATATYPE_MISMATCH),
3066 errdetail(
"Table has type %s, but query expects %s.",
3098 op->d.fieldstore.rowcache, NULL);
3102 elog(
ERROR,
"too many columns in composite type %u",
3103 op->d.fieldstore.fstore->resulttype);
3108 memset(
op->d.fieldstore.nulls,
true,
3109 op->d.fieldstore.ncolumns *
sizeof(
bool));
3117 Datum tupDatum = *
op->resvalue;
3128 op->d.fieldstore.values,
3129 op->d.fieldstore.nulls);
3145 op->d.fieldstore.rowcache, NULL);
3148 op->d.fieldstore.values,
3149 op->d.fieldstore.nulls);
3152 *
op->resnull =
false;
3170 bool changed =
false;
3176 tupDatum = *
op->resvalue;
3185 op->d.convert_rowtype.incache,
3189 op->d.convert_rowtype.outcache,
3220 if (
op->d.convert_rowtype.map != NULL)
3260 bool useOr =
op->d.scalararrayop.useOr;
3261 bool strictfunc =
op->d.scalararrayop.finfo->fn_strict;
3293 *
op->resnull =
false;
3303 *
op->resnull =
true;
3314 &
op->d.scalararrayop.typlen,
3315 &
op->d.scalararrayop.typbyval,
3316 &
op->d.scalararrayop.typalign);
3320 typlen =
op->d.scalararrayop.typlen;
3339 if (bitmap && (*bitmap & bitmask) == 0)
3357 thisresult = (
Datum) 0;
3362 thisresult =
op->d.scalararrayop.fn_addr(fcinfo);
3391 if (bitmask == 0x100)
3399 *
op->resvalue = result;
3400 *
op->resnull = resultnull;
3416 fcinfo->args[0].value =
key;
3417 fcinfo->args[0].isnull =
false;
3436 fcinfo->args[0].value = key1;
3437 fcinfo->args[0].isnull =
false;
3438 fcinfo->args[1].value = key2;
3439 fcinfo->args[1].isnull =
false;
3464 bool inclause =
op->d.hashedscalararrayop.inclause;
3465 bool strictfunc =
op->d.hashedscalararrayop.finfo->fn_strict;
3481 *
op->resnull =
true;
3500 saop =
op->d.hashedscalararrayop.saop;
3545 if (bitmap && (*bitmap & bitmask) == 0)
3564 if (bitmask == 0x100)
3596 if (!hashfound &&
op->d.hashedscalararrayop.has_nulls)
3622 result =
op->d.hashedscalararrayop.finfo->fn_addr(fcinfo);
3623 resultnull = fcinfo->
isnull;
3634 *
op->resvalue = result;
3635 *
op->resnull = resultnull;
3646 (
errcode(ERRCODE_NOT_NULL_VIOLATION),
3647 errmsg(
"domain %s does not allow null values",
3658 if (!*
op->d.domaincheck.checknull &&
3661 (
errcode(ERRCODE_CHECK_VIOLATION),
3662 errmsg(
"value for domain %s violates check constraint \"%s\"",
3664 op->d.domaincheck.constraintname),
3666 op->d.domaincheck.constraintname)));
3681 *
op->resnull =
true;
3701 *
op->resnull =
false;
3709 bool *
argnull =
op->d.xmlexpr.named_argnull;
3731 *
op->resnull =
false;
3750 op->d.xmlexpr.named_argvalue,
3751 op->d.xmlexpr.named_argnull,
3752 op->d.xmlexpr.argvalue,
3753 op->d.xmlexpr.argnull));
3754 *
op->resnull =
false;
3762 bool preserve_whitespace;
3779 preserve_whitespace));
3780 *
op->resnull =
false;
3839 *
op->resnull =
false;
3859 *
op->resnull =
false;
3877 *
op->resnull =
false;
3882 elog(
ERROR,
"unrecognized XML operation");
3904 foreach(lc,
op->d.grouping_func.clauses)
3915 *
op->resnull =
false;
3973 if (
op->d.wholerow.junkFilter != NULL)
3983 if (
op->d.wholerow.first)
3986 op->d.wholerow.slow =
false;
3992 if (
variable->vartype != RECORDOID)
4017 if (var_tupdesc->
natts != slot_tupdesc->
natts)
4019 (
errcode(ERRCODE_DATATYPE_MISMATCH),
4020 errmsg(
"table row type and query-specified row type do not match"),
4022 "Table row contains %d attributes, but query expects %d.",
4023 slot_tupdesc->
natts,
4024 slot_tupdesc->
natts,
4025 var_tupdesc->
natts)));
4027 for (
int i = 0;
i < var_tupdesc->
natts;
i++)
4032 if (vattr->atttypid == sattr->atttypid)
4034 if (!vattr->attisdropped)
4036 (
errcode(ERRCODE_DATATYPE_MISMATCH),
4037 errmsg(
"table row type and query-specified row type do not match"),
4038 errdetail(
"Table has type %s at ordinal position %d, but query expects %s.",
4043 if (vattr->attlen != sattr->attlen ||
4044 vattr->attalign != sattr->attalign)
4045 op->d.wholerow.slow =
true;
4075 output_tupdesc->
tdtypeid = RECORDOID;
4106 op->d.wholerow.first =
false;
4115 if (
op->d.wholerow.slow)
4123 for (
int i = 0;
i < var_tupdesc->
natts;
i++)
4128 if (!vattr->attisdropped)
4132 if (vattr->attlen != sattr->attlen ||
4133 vattr->attalign != sattr->attalign)
4135 (
errcode(ERRCODE_DATATYPE_MISMATCH),
4136 errmsg(
"table row type and query-specified row type do not match"),
4137 errdetail(
"Physical storage mismatch on dropped attribute at ordinal position %d.",
4162 *
op->resnull =
false;
4178 elog(
ERROR,
"failed to fetch attribute from slot");
4215 Datum newValue,
bool newValueIsNull,
4216 Datum oldValue,
bool oldValueIsNull)
4218 Assert(newValue != oldValue);
4220 if (!newValueIsNull)
4240 newValue = (
Datum) 0;
4243 if (!oldValueIsNull)
4343 int setno =
op->d.agg_trans.setno;
4346 *
op->resvalue, *
op->resnull);
4357 int setno =
op->d.agg_trans.setno;
4484 elog(
ERROR,
"invalid JsonConstructorExpr type %d", ctor->
type);
4487 *
op->resvalue =
res;
#define DatumGetArrayTypePCopy(X)
#define ARR_NULLBITMAP(a)
#define ARR_OVERHEAD_WITHNULLS(ndims, nitems)
#define DatumGetArrayTypeP(X)
#define ARR_OVERHEAD_NONULLS(ndims)
#define ARR_DATA_OFFSET(a)
Datum array_map(Datum arrayd, ExprState *exprstate, ExprContext *econtext, Oid retType, ArrayMapState *amstate)
ArrayType * construct_empty_array(Oid elmtype)
ArrayType * construct_md_array(Datum *elems, bool *nulls, int ndims, int *dims, int *lbs, Oid elmtype, int elmlen, bool elmbyval, char elmalign)
void array_bitmap_copy(bits8 *destbitmap, int destoffset, const bits8 *srcbitmap, int srcoffset, int nitems)
int ArrayGetNItems(int ndim, const int *dims)
void ArrayCheckBounds(int ndim, const int *dims, const int *lb)
#define InvalidAttrNumber
bool bms_is_member(int x, const Bitmapset *a)
static Datum values[MAXATTR]
#define pg_attribute_always_inline
#define StaticAssertDecl(condition, errmessage)
#define OidIsValid(objectId)
Datum datumCopy(Datum value, bool typByVal, int typLen)
static void PGresult * res
elog(ERROR, "%s: %s", p2, msg)
int errdatatype(Oid datatypeOid)
int errdomainconstraint(Oid datatypeOid, const char *conname)
int errdetail(const char *fmt,...)
int errdetail_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void ExecEvalParamExtern(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalFieldStoreForm(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalGroupingFunc(ExprState *state, ExprEvalStep *op)
static void CheckVarSlotCompatibility(TupleTableSlot *slot, int attnum, Oid vartype)
void ExecEvalRow(ExprState *state, ExprEvalStep *op)
static pg_attribute_always_inline Datum ExecJustVarVirtImpl(ExprState *state, TupleTableSlot *slot, bool *isnull)
static pg_attribute_always_inline Datum ExecJustAssignVarImpl(ExprState *state, TupleTableSlot *inslot, bool *isnull)
void ExecEvalFieldStoreDeForm(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalCurrentOfExpr(ExprState *state, ExprEvalStep *op)
void ExecEvalRowNull(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op)
static Datum ExecJustAssignInnerVarVirt(ExprState *state, ExprContext *econtext, bool *isnull)
static Datum ExecJustScanVarVirt(ExprState *state, ExprContext *econtext, bool *isnull)
static Datum ExecJustApplyFuncToCase(ExprState *state, ExprContext *econtext, bool *isnull)
Datum ExecInterpExprStillValid(ExprState *state, ExprContext *econtext, bool *isNull)
static pg_attribute_always_inline void ExecAggPlainTransByVal(AggState *aggstate, AggStatePerTrans pertrans, AggStatePerGroup pergroup, ExprContext *aggcontext, int setno)
struct ScalarArrayOpExprHashEntry ScalarArrayOpExprHashEntry
static Datum ExecJustAssignScanVar(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)
struct ScalarArrayOpExprHashTable ScalarArrayOpExprHashTable
static Datum ExecJustInnerVarVirt(ExprState *state, ExprContext *econtext, bool *isnull)
void ExecEvalConstraintNotNull(ExprState *state, ExprEvalStep *op)
static void ExecInitInterpreter(void)
void ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op)
void ExecEvalAggOrderedTransDatum(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
static Datum ExecJustConst(ExprState *state, ExprContext *econtext, bool *isnull)
static Datum ExecJustOuterVar(ExprState *state, ExprContext *econtext, bool *isnull)
void ExecEvalParamExec(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecAggInitGroup(AggState *aggstate, AggStatePerTrans pertrans, AggStatePerGroup pergroup, ExprContext *aggcontext)
static pg_attribute_always_inline Datum ExecJustAssignVarVirtImpl(ExprState *state, TupleTableSlot *inslot, bool *isnull)
void ExecEvalNextValueExpr(ExprState *state, ExprEvalStep *op)
void ExecEvalSysVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext, TupleTableSlot *slot)
static bool saop_hash_element_match(struct saophash_hash *tb, Datum key1, Datum key2)
void ExecEvalMinMax(ExprState *state, ExprEvalStep *op)
void ExecEvalSubPlan(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
static uint32 saop_element_hash(struct saophash_hash *tb, Datum key)
static Datum ExecJustInnerVar(ExprState *state, ExprContext *econtext, bool *isnull)
static Datum ExecJustAssignInnerVar(ExprState *state, ExprContext *econtext, bool *isnull)
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 ExecReadyInterpretedExpr(ExprState *state)
static Datum ExecJustAssignScanVarVirt(ExprState *state, ExprContext *econtext, bool *isnull)
static void ExecEvalRowNullInt(ExprState *state, ExprEvalStep *op, ExprContext *econtext, bool checkisnull)
void ExecEvalRowNotNull(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
ExprEvalOp ExecEvalStepOp(ExprState *state, ExprEvalStep *op)
static Datum ExecJustAssignOuterVar(ExprState *state, ExprContext *econtext, bool *isnull)
static Datum ExecJustAssignOuterVarVirt(ExprState *state, ExprContext *econtext, bool *isnull)
void ExecEvalConstraintCheck(ExprState *state, ExprEvalStep *op)
void ExecEvalArrayCoerce(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
static void CheckOpSlotCompatibility(ExprEvalStep *op, TupleTableSlot *slot)
void ExecEvalFuncExprStrictFusage(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
static Datum ExecJustOuterVarVirt(ExprState *state, ExprContext *econtext, bool *isnull)
static Datum ExecJustScanVar(ExprState *state, ExprContext *econtext, bool *isnull)
static Datum ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
static pg_attribute_always_inline Datum ExecJustVarImpl(ExprState *state, TupleTableSlot *slot, bool *isnull)
void ExecEvalFuncExprFusage(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
void ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op)
bool ExecEvalPreOrderedDistinctSingle(AggState *aggstate, AggStatePerTrans pertrans)
#define EEO_OPCODE(opcode)
static pg_attribute_always_inline void ExecAggPlainTransByRef(AggState *aggstate, AggStatePerTrans pertrans, AggStatePerGroup pergroup, ExprContext *aggcontext, int setno)
void ExecEvalAggOrderedTransTuple(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
static TupleDesc get_cached_rowtype(Oid type_id, int32 typmod, ExprEvalRowtypeCache *rowcache, bool *changed)
Datum ExecAggTransReparent(AggState *aggstate, AggStatePerTrans pertrans, Datum newValue, bool newValueIsNull, Datum oldValue, bool oldValueIsNull)
#define EEO_FLAG_INTERPRETER_INITIALIZED
#define EEO_FLAG_DIRECT_THREADED
@ EEOP_FUNCEXPR_STRICT_FUSAGE
@ EEOP_AGG_PLAIN_PERGROUP_NULLCHECK
@ EEOP_AGG_STRICT_DESERIALIZE
@ EEOP_BOOLTEST_IS_NOT_FALSE
@ EEOP_AGG_PLAIN_TRANS_BYREF
@ EEOP_AGG_PRESORTED_DISTINCT_MULTI
@ EEOP_AGG_PLAIN_TRANS_BYVAL
@ EEOP_NULLTEST_ROWISNOTNULL
@ EEOP_ASSIGN_TMP_MAKE_RO
@ EEOP_BOOL_OR_STEP_FIRST
@ EEOP_AGG_STRICT_INPUT_CHECK_NULLS
@ EEOP_AGG_STRICT_INPUT_CHECK_ARGS
@ EEOP_NULLTEST_ROWISNULL
@ EEOP_NULLTEST_ISNOTNULL
@ EEOP_AGG_PRESORTED_DISTINCT_SINGLE
@ EEOP_BOOL_AND_STEP_FIRST
@ EEOP_BOOL_AND_STEP_LAST
@ EEOP_AGG_ORDERED_TRANS_DATUM
@ EEOP_AGG_PLAIN_TRANS_STRICT_BYREF
@ EEOP_BOOLTEST_IS_NOT_TRUE
@ EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYVAL
@ EEOP_AGG_PLAIN_TRANS_STRICT_BYVAL
@ EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYREF
@ EEOP_HASHED_SCALARARRAYOP
@ EEOP_AGG_ORDERED_TRANS_TUPLE
TupleTableSlot * ExecFilterJunk(JunkFilter *junkfilter, TupleTableSlot *slot)
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
const TupleTableSlotOps TTSOpsVirtual
TupleTableSlot * ExecStoreVirtualTuple(TupleTableSlot *slot)
void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList)
const TupleTableSlotOps TTSOpsBufferHeapTuple
const TupleTableSlotOps TTSOpsHeapTuple
Datum(* ExprStateEvalFunc)(struct ExprState *expression, struct ExprContext *econtext, bool *isNull)
static RangeTblEntry * exec_rt_fetch(Index rti, EState *estate)
static bool ExecQual(ExprState *state, ExprContext *econtext)
ExpandedObjectHeader * DatumGetEOHP(Datum d)
void DeleteExpandedObject(Datum d)
Datum MakeExpandedObjectReadOnlyInternal(Datum d)
#define DatumIsReadWriteExpandedObject(d, isnull, typlen)
static Datum expanded_record_get_field(ExpandedRecordHeader *erh, int fnumber, bool *isnull)
static TupleDesc expanded_record_get_tupdesc(ExpandedRecordHeader *erh)
Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)
void fmgr_info(Oid functionId, FmgrInfo *finfo)
Datum Int64GetDatum(int64 X)
#define DatumGetHeapTupleHeader(X)
#define DatumGetTextPP(X)
#define SizeForFunctionCallInfo(nargs)
#define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo)
#define FunctionCallInvoke(fcinfo)
#define fmgr_info_set_expr(expr, finfo)
static Datum HeapTupleGetDatum(const HeapTupleData *tuple)
HeapTuple toast_build_flattened_tuple(TupleDesc tupleDesc, Datum *values, bool *isnull)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
bool heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc)
void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *values, bool *isnull)
Datum heap_copy_tuple_as_datum(HeapTuple tuple, TupleDesc tupleDesc)
#define HeapTupleHeaderSetTypMod(tup, typmod)
static Datum heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
#define HeapTupleHeaderGetTypMod(tup)
#define HeapTupleHeaderGetTypeId(tup)
#define HeapTupleHeaderGetDatumLength(tup)
#define HeapTupleHeaderSetTypeId(tup, typeid)
if(TABLE==NULL||TABLE_index==NULL)
static void ItemPointerSetInvalid(ItemPointerData *pointer)
Datum json_build_array_worker(int nargs, Datum *args, bool *nulls, Oid *types, bool absent_on_null)
Datum json_build_object_worker(int nargs, Datum *args, bool *nulls, Oid *types, bool absent_on_null, bool unique_keys)
Datum jsonb_build_array_worker(int nargs, Datum *args, bool *nulls, Oid *types, bool absent_on_null)
Datum jsonb_build_object_worker(int nargs, Datum *args, bool *nulls, Oid *types, bool absent_on_null, bool unique_keys)
Assert(fmt[strlen(fmt) - 1] !='\n')
List * lappend(List *list, void *datum)
void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval, char *typalign)
void pfree(void *pointer)
void * palloc0(Size size)
MemoryContext CurrentMemoryContext
MemoryContext MemoryContextGetParent(MemoryContext context)
#define AllocSizeIsValid(size)
Oid exprType(const Node *expr)
void ExecSetParamPlan(SubPlanState *node, ExprContext *econtext)
Datum ExecSubPlan(SubPlanState *node, ExprContext *econtext, bool *isNull)
#define castNode(_type_, nodeptr)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
FormData_pg_attribute * Form_pg_attribute
static int list_length(const List *l)
#define forboth(cell1, list1, cell2, list2)
void pgstat_init_function_usage(FunctionCallInfo fcinfo, PgStat_FunctionCallUsage *fcu)
void pgstat_end_function_usage(PgStat_FunctionCallUsage *fcu, bool finalize)
#define qsort(a, b, c, d)
void check_stack_depth(void)
static uint32 DatumGetUInt32(Datum X)
static bool DatumGetBool(Datum X)
static Datum PointerGetDatum(const void *X)
static char * DatumGetCString(Datum X)
static Datum Int16GetDatum(int16 X)
static Datum BoolGetDatum(bool X)
static Pointer DatumGetPointer(Datum X)
static Datum Int32GetDatum(int32 X)
static int32 DatumGetInt32(Datum X)
static chr element(struct vars *v, const chr *startp, const chr *endp)
static unsigned hash(unsigned *uv, int n)
int64 nextval_internal(Oid relid, bool check_permissions)
void appendStringInfo(StringInfo str, const char *fmt,...)
void initStringInfo(StringInfo str)
TupleTableSlot * sortslot
Tuplesortstate ** sortstates
TupleTableSlot * uniqslot
FunctionCallInfo transfn_fcinfo
AggStatePerGroup * all_pergroups
ExprContext * curaggcontext
AggStatePerTrans curpertrans
Index es_range_table_size
ParamListInfo ecxt_param_list_info
MemoryContext ecxt_per_tuple_memory
TupleTableSlot * ecxt_innertuple
ParamExecData * ecxt_param_exec_vals
TupleTableSlot * ecxt_scantuple
MemoryContext ecxt_per_query_memory
struct EState * ecxt_estate
TupleTableSlot * ecxt_outertuple
struct ScalarArrayOpExprHashTable * elements_tab
AggStatePerTrans pertrans
union ExprEvalStep::@50 d
struct ExprEvalStep::@50::@81 hashedscalararrayop
ExprEvalRowtypeCache rowcache
struct JsonConstructorExprState * jcstate
NullableDatum args[FLEXIBLE_ARRAY_MEMBER]
JsonConstructorExpr * constructor
JsonReturning * returning