88 #ifdef HAVE_COMPUTED_GOTO
89 #define EEO_USE_COMPUTED_GOTO
102 #if defined(EEO_USE_COMPUTED_GOTO)
105 typedef struct ExprEvalOpLookup
112 static const void **dispatch_table = NULL;
115 static ExprEvalOpLookup reverse_dispatch_table[
EEOP_LAST];
118 #define EEO_CASE(name) CASE_##name:
119 #define EEO_DISPATCH() goto *((void *) op->opcode)
120 #define EEO_OPCODE(opcode) ((intptr_t) dispatch_table[opcode])
124 #define EEO_SWITCH() starteval: switch ((ExprEvalOp) op->opcode)
125 #define EEO_CASE(name) case name:
126 #define EEO_DISPATCH() goto starteval
127 #define EEO_OPCODE(opcode) (opcode)
137 #define EEO_JUMP(stepno) \
139 op = &state->steps[stepno]; \
196 #define SH_PREFIX saophash
197 #define SH_ELEMENT_TYPE ScalarArrayOpExprHashEntry
198 #define SH_KEY_TYPE Datum
199 #define SH_SCOPE static inline
220 #define SH_PREFIX saophash
221 #define SH_ELEMENT_TYPE ScalarArrayOpExprHashEntry
222 #define SH_KEY_TYPE Datum
224 #define SH_HASH_KEY(tb, key) saop_element_hash(tb, key)
225 #define SH_EQUAL(tb, a, b) saop_hash_element_match(tb, a, b)
226 #define SH_SCOPE static inline
227 #define SH_STORE_HASH
228 #define SH_GET_HASH(tb, a) a->hash
276 if (
state->steps_len == 3)
319 state->steps[0].d.casetest.value)
325 else if (
state->steps_len == 2)
366 #if defined(EEO_USE_COMPUTED_GOTO)
372 for (
int off = 0; off <
state->steps_len; off++)
407 #if defined(EEO_USE_COMPUTED_GOTO)
408 static const void *
const dispatch_table[] = {
410 &&CASE_EEOP_INNER_FETCHSOME,
411 &&CASE_EEOP_OUTER_FETCHSOME,
412 &&CASE_EEOP_SCAN_FETCHSOME,
413 &&CASE_EEOP_INNER_VAR,
414 &&CASE_EEOP_OUTER_VAR,
415 &&CASE_EEOP_SCAN_VAR,
416 &&CASE_EEOP_INNER_SYSVAR,
417 &&CASE_EEOP_OUTER_SYSVAR,
418 &&CASE_EEOP_SCAN_SYSVAR,
419 &&CASE_EEOP_WHOLEROW,
420 &&CASE_EEOP_ASSIGN_INNER_VAR,
421 &&CASE_EEOP_ASSIGN_OUTER_VAR,
422 &&CASE_EEOP_ASSIGN_SCAN_VAR,
423 &&CASE_EEOP_ASSIGN_TMP,
424 &&CASE_EEOP_ASSIGN_TMP_MAKE_RO,
426 &&CASE_EEOP_FUNCEXPR,
427 &&CASE_EEOP_FUNCEXPR_STRICT,
428 &&CASE_EEOP_FUNCEXPR_FUSAGE,
429 &&CASE_EEOP_FUNCEXPR_STRICT_FUSAGE,
430 &&CASE_EEOP_BOOL_AND_STEP_FIRST,
431 &&CASE_EEOP_BOOL_AND_STEP,
432 &&CASE_EEOP_BOOL_AND_STEP_LAST,
433 &&CASE_EEOP_BOOL_OR_STEP_FIRST,
434 &&CASE_EEOP_BOOL_OR_STEP,
435 &&CASE_EEOP_BOOL_OR_STEP_LAST,
436 &&CASE_EEOP_BOOL_NOT_STEP,
439 &&CASE_EEOP_JUMP_IF_NULL,
440 &&CASE_EEOP_JUMP_IF_NOT_NULL,
441 &&CASE_EEOP_JUMP_IF_NOT_TRUE,
442 &&CASE_EEOP_NULLTEST_ISNULL,
443 &&CASE_EEOP_NULLTEST_ISNOTNULL,
444 &&CASE_EEOP_NULLTEST_ROWISNULL,
445 &&CASE_EEOP_NULLTEST_ROWISNOTNULL,
446 &&CASE_EEOP_BOOLTEST_IS_TRUE,
447 &&CASE_EEOP_BOOLTEST_IS_NOT_TRUE,
448 &&CASE_EEOP_BOOLTEST_IS_FALSE,
449 &&CASE_EEOP_BOOLTEST_IS_NOT_FALSE,
450 &&CASE_EEOP_PARAM_EXEC,
451 &&CASE_EEOP_PARAM_EXTERN,
452 &&CASE_EEOP_PARAM_CALLBACK,
453 &&CASE_EEOP_PARAM_SET,
454 &&CASE_EEOP_CASE_TESTVAL,
455 &&CASE_EEOP_MAKE_READONLY,
456 &&CASE_EEOP_IOCOERCE,
457 &&CASE_EEOP_IOCOERCE_SAFE,
458 &&CASE_EEOP_DISTINCT,
459 &&CASE_EEOP_NOT_DISTINCT,
461 &&CASE_EEOP_SQLVALUEFUNCTION,
462 &&CASE_EEOP_CURRENTOFEXPR,
463 &&CASE_EEOP_NEXTVALUEEXPR,
464 &&CASE_EEOP_ARRAYEXPR,
465 &&CASE_EEOP_ARRAYCOERCE,
467 &&CASE_EEOP_ROWCOMPARE_STEP,
468 &&CASE_EEOP_ROWCOMPARE_FINAL,
470 &&CASE_EEOP_FIELDSELECT,
471 &&CASE_EEOP_FIELDSTORE_DEFORM,
472 &&CASE_EEOP_FIELDSTORE_FORM,
473 &&CASE_EEOP_SBSREF_SUBSCRIPTS,
474 &&CASE_EEOP_SBSREF_OLD,
475 &&CASE_EEOP_SBSREF_ASSIGN,
476 &&CASE_EEOP_SBSREF_FETCH,
477 &&CASE_EEOP_DOMAIN_TESTVAL,
478 &&CASE_EEOP_DOMAIN_NOTNULL,
479 &&CASE_EEOP_DOMAIN_CHECK,
480 &&CASE_EEOP_HASHDATUM_SET_INITVAL,
481 &&CASE_EEOP_HASHDATUM_FIRST,
482 &&CASE_EEOP_HASHDATUM_FIRST_STRICT,
483 &&CASE_EEOP_HASHDATUM_NEXT32,
484 &&CASE_EEOP_HASHDATUM_NEXT32_STRICT,
485 &&CASE_EEOP_CONVERT_ROWTYPE,
486 &&CASE_EEOP_SCALARARRAYOP,
487 &&CASE_EEOP_HASHED_SCALARARRAYOP,
489 &&CASE_EEOP_JSON_CONSTRUCTOR,
491 &&CASE_EEOP_JSONEXPR_PATH,
492 &&CASE_EEOP_JSONEXPR_COERCION,
493 &&CASE_EEOP_JSONEXPR_COERCION_FINISH,
495 &&CASE_EEOP_GROUPING_FUNC,
496 &&CASE_EEOP_WINDOW_FUNC,
497 &&CASE_EEOP_MERGE_SUPPORT_FUNC,
499 &&CASE_EEOP_AGG_STRICT_DESERIALIZE,
500 &&CASE_EEOP_AGG_DESERIALIZE,
501 &&CASE_EEOP_AGG_STRICT_INPUT_CHECK_ARGS,
502 &&CASE_EEOP_AGG_STRICT_INPUT_CHECK_NULLS,
503 &&CASE_EEOP_AGG_PLAIN_PERGROUP_NULLCHECK,
504 &&CASE_EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYVAL,
505 &&CASE_EEOP_AGG_PLAIN_TRANS_STRICT_BYVAL,
506 &&CASE_EEOP_AGG_PLAIN_TRANS_BYVAL,
507 &&CASE_EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYREF,
508 &&CASE_EEOP_AGG_PLAIN_TRANS_STRICT_BYREF,
509 &&CASE_EEOP_AGG_PLAIN_TRANS_BYREF,
510 &&CASE_EEOP_AGG_PRESORTED_DISTINCT_SINGLE,
511 &&CASE_EEOP_AGG_PRESORTED_DISTINCT_MULTI,
512 &&CASE_EEOP_AGG_ORDERED_TRANS_DATUM,
513 &&CASE_EEOP_AGG_ORDERED_TRANS_TUPLE,
518 "dispatch_table out of whack with ExprEvalOp");
528 resultslot =
state->resultslot;
533 #if defined(EEO_USE_COMPUTED_GOTO)
643 int attnum =
op->d.assign_var.attnum;
650 Assert(
resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);
660 int attnum =
op->d.assign_var.attnum;
667 Assert(
resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);
677 int attnum =
op->d.assign_var.attnum;
684 Assert(
resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);
695 Assert(
resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);
706 Assert(
resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);
719 *
op->resnull =
op->d.constval.isnull;
720 *
op->resvalue =
op->d.constval.value;
746 d =
op->d.func.fn_addr(fcinfo);
761 for (
int argno = 0; argno <
nargs; argno++)
770 d =
op->d.func.fn_addr(fcinfo);
806 *
op->d.boolexpr.anynull =
false;
820 *
op->d.boolexpr.anynull =
true;
848 else if (*
op->d.boolexpr.anynull)
873 *
op->d.boolexpr.anynull =
false;
887 *
op->d.boolexpr.anynull =
true;
915 else if (*
op->d.boolexpr.anynull)
950 *
op->resnull =
false;
999 *
op->resnull =
false;
1007 *
op->resnull =
false;
1035 *
op->resnull =
false;
1047 *
op->resnull =
false;
1060 *
op->resnull =
false;
1073 *
op->resnull =
false;
1098 op->d.cparam.paramfunc(
state,
op, econtext);
1120 if (
op->d.casetest.value)
1122 *
op->resvalue = *
op->d.casetest.value;
1123 *
op->resnull = *
op->d.casetest.isnull;
1139 if (
op->d.casetest.value)
1141 *
op->resvalue = *
op->d.casetest.value;
1142 *
op->resnull = *
op->d.casetest.isnull;
1158 if (!*
op->d.make_readonly.isnull)
1161 *
op->resnull = *
op->d.make_readonly.isnull;
1188 fcinfo_out =
op->d.iocoerce.fcinfo_data_out;
1192 fcinfo_out->
isnull =
false;
1200 if (!
op->d.iocoerce.finfo_in->fn_strict ||
str != NULL)
1205 fcinfo_in =
op->d.iocoerce.fcinfo_data_in;
1210 fcinfo_in->
isnull =
false;
1254 *
op->resnull =
false;
1260 *
op->resnull =
false;
1268 eqresult =
op->d.func.fn_addr(fcinfo);
1285 *
op->resnull =
false;
1290 *
op->resnull =
false;
1297 eqresult =
op->d.func.fn_addr(fcinfo);
1298 *
op->resvalue = eqresult;
1318 result =
op->d.func.fn_addr(fcinfo);
1324 *
op->resnull =
true;
1397 if (
op->d.rowcompare_step.finfo->fn_strict &&
1400 *
op->resnull =
true;
1406 d =
op->d.rowcompare_step.fn_addr(fcinfo);
1412 *
op->resnull =
true;
1415 *
op->resnull =
false;
1431 *
op->resnull =
false;
1490 if (
op->d.sbsref_subscript.subscriptfunc(
state,
op, econtext))
1506 op->d.sbsref.subscriptfunc(
state,
op, econtext);
1553 *
op->resvalue =
op->d.hashdatum_initvalue.init_value;
1554 *
op->resnull =
false;
1568 *
op->resvalue =
op->d.hashdatum.fn_addr(fcinfo);
1572 *
op->resnull =
false;
1588 *
op->resnull =
true;
1594 *
op->resvalue =
op->d.hashdatum.fn_addr(fcinfo);
1595 *
op->resnull =
false;
1615 existing_hash = existing_hash ^ hashvalue;
1619 *
op->resnull =
false;
1635 *
op->resnull =
true;
1650 *
op->resnull =
false;
1707 int aggno =
op->d.aggref.aggno;
1760 if (
op->d.agg_deserialize.fcinfo_data->args[0].isnull)
1794 int nargs =
op->d.agg_strict_input_check.nargs;
1796 for (
int argno = 0; argno <
nargs; argno++)
1799 EEO_JUMP(
op->d.agg_strict_input_check.jumpnull);
1806 bool *
nulls =
op->d.agg_strict_input_check.nulls;
1807 int nargs =
op->d.agg_strict_input_check.nargs;
1809 for (
int argno = 0; argno <
nargs; argno++)
1812 EEO_JUMP(
op->d.agg_strict_input_check.jumpnull);
1827 if (pergroup_allaggs == NULL)
1828 EEO_JUMP(
op->d.agg_plain_pergroup_nullcheck.jumpnull);
1858 op->d.agg_trans.aggcontext);
1865 op->d.agg_trans.aggcontext,
1866 op->d.agg_trans.setno);
1884 op->d.agg_trans.aggcontext,
1885 op->d.agg_trans.setno);
1901 op->d.agg_trans.aggcontext,
1902 op->d.agg_trans.setno);
1919 op->d.agg_trans.aggcontext);
1922 op->d.agg_trans.aggcontext,
1923 op->d.agg_trans.setno);
1940 op->d.agg_trans.aggcontext,
1941 op->d.agg_trans.setno);
1956 op->d.agg_trans.aggcontext,
1957 op->d.agg_trans.setno);
1970 EEO_JUMP(
op->d.agg_presorted_distinctcheck.jumpdistinct);
1981 EEO_JUMP(
op->d.agg_presorted_distinctcheck.jumpdistinct);
2012 return state->resvalue;
2033 return state->evalfunc(
state, econtext, isNull);
2051 for (
int i = 0;
i <
state->steps_len;
i++)
2117 elog(
ERROR,
"attribute number %d exceeds number of columns %d",
2122 if (attr->attisdropped)
2124 (
errcode(ERRCODE_UNDEFINED_COLUMN),
2125 errmsg(
"attribute %d of type %s has been dropped",
2128 if (
vartype != attr->atttypid)
2130 (
errcode(ERRCODE_DATATYPE_MISMATCH),
2131 errmsg(
"attribute %d of type %s has wrong type",
2133 errdetail(
"Table has type %s, but query expects %s.",
2145 #ifdef USE_ASSERT_CHECKING
2147 if (!
op->d.fetch.fixed)
2194 if (type_id != RECORDOID)
2210 if (typentry->
tupDesc == NULL)
2212 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2213 errmsg(
"type %s is not composite",
2297 int attnum =
op->d.assign_var.attnum + 1;
2312 Assert(
resultnum >= 0 && resultnum < outslot->tts_tupleDescriptor->natts);
2353 *
op->resvalue = *
op->d.casetest.value;
2354 *
op->resnull = *
op->d.casetest.isnull;
2359 fcinfo =
op->d.func.fcinfo_data;
2363 for (
int argno = 0; argno <
nargs; argno++)
2372 d =
op->d.func.fn_addr(fcinfo);
2384 return op->d.constval.value;
2435 int attnum =
op->d.assign_var.attnum;
2444 Assert(
resultnum >= 0 && resultnum < outslot->tts_tupleDescriptor->natts);
2473 #if defined(EEO_USE_COMPUTED_GOTO)
2479 dispatch_compare_ptr(
const void *
a,
const void *
b)
2481 const ExprEvalOpLookup *la = (
const ExprEvalOpLookup *)
a;
2482 const ExprEvalOpLookup *lb = (
const ExprEvalOpLookup *)
b;
2484 if (la->opcode < lb->opcode)
2486 else if (la->opcode > lb->opcode)
2498 #if defined(EEO_USE_COMPUTED_GOTO)
2500 if (dispatch_table == NULL)
2502 dispatch_table = (
const void **)
2508 reverse_dispatch_table[
i].opcode = dispatch_table[
i];
2513 qsort(reverse_dispatch_table,
2515 sizeof(ExprEvalOpLookup),
2516 dispatch_compare_ptr);
2530 #if defined(EEO_USE_COMPUTED_GOTO)
2533 ExprEvalOpLookup
key;
2534 ExprEvalOpLookup *
res;
2536 key.opcode = (
void *)
op->opcode;
2538 reverse_dispatch_table,
2540 sizeof(ExprEvalOpLookup),
2541 dispatch_compare_ptr);
2568 d =
op->d.func.fn_addr(fcinfo);
2590 for (
int argno = 0; argno <
nargs; argno++)
2594 *
op->resnull =
true;
2602 d =
op->d.func.fn_addr(fcinfo);
2641 int paramId =
op->d.param.paramid;
2644 paramId > 0 && paramId <= paramInfo->numParams))
2651 prm = paramInfo->
paramFetch(paramInfo, paramId,
false, &prmdata);
2653 prm = ¶mInfo->
params[paramId - 1];
2660 (
errcode(ERRCODE_DATATYPE_MISMATCH),
2661 errmsg(
"type of parameter %d (%s) does not match that when preparing the plan (%s)",
2672 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2673 errmsg(
"no value found for parameter %d", paramId)));
2717 fcinfo_out =
op->d.iocoerce.fcinfo_data_out;
2721 fcinfo_out->
isnull =
false;
2729 if (!
op->d.iocoerce.finfo_in->fn_strict ||
str != NULL)
2733 fcinfo_in =
op->d.iocoerce.fcinfo_data_in;
2741 fcinfo_in->
isnull =
false;
2746 *
op->resnull =
true;
2768 *
op->resnull =
false;
2800 *
op->resnull = fcinfo->isnull;
2805 *
op->resnull = fcinfo->isnull;
2810 *
op->resnull = fcinfo->isnull;
2815 *
op->resnull = fcinfo->isnull;
2833 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2834 errmsg(
"WHERE CURRENT OF is not supported for this table type")));
2845 switch (
op->d.nextvalueexpr.seqtypid)
2857 elog(
ERROR,
"unsupported sequence type %u",
2858 op->d.nextvalueexpr.seqtypid);
2860 *
op->resnull =
false;
2894 *
op->resnull =
false;
2926 &
op->d.nulltest_row.rowcache, NULL);
2934 for (
int att = 1; att <= tupDesc->
natts; att++)
2973 int nelems =
op->d.arrayexpr.nelems;
2979 *
op->resnull =
false;
2981 if (!
op->d.arrayexpr.multidims)
2984 Datum *dvalues =
op->d.arrayexpr.elemvalues;
2985 bool *dnulls =
op->d.arrayexpr.elemnulls;
2994 op->d.arrayexpr.elemlength,
2995 op->d.arrayexpr.elembyval,
2996 op->d.arrayexpr.elemalign);
3003 int outer_nelems = 0;
3005 int *elem_dims = NULL;
3006 int *elem_lbs = NULL;
3007 bool firstone =
true;
3008 bool havenulls =
false;
3009 bool haveempty =
false;
3024 for (
int elemoff = 0; elemoff <
nelems; elemoff++)
3031 arraydatum =
op->d.arrayexpr.elemvalues[elemoff];
3032 eisnull =
op->d.arrayexpr.elemnulls[elemoff];
3046 (
errcode(ERRCODE_DATATYPE_MISMATCH),
3047 errmsg(
"cannot merge incompatible arrays"),
3048 errdetail(
"Array with element type %s cannot be "
3049 "included in ARRAY construct with element type %s.",
3055 if (this_ndims <= 0)
3064 elem_ndims = this_ndims;
3065 ndims = elem_ndims + 1;
3066 if (ndims <= 0 || ndims >
MAXDIM)
3068 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
3069 errmsg(
"number of array dimensions (%d) exceeds the maximum allowed (%d)",
3072 elem_dims = (
int *)
palloc(elem_ndims *
sizeof(
int));
3073 memcpy(elem_dims,
ARR_DIMS(array), elem_ndims *
sizeof(
int));
3074 elem_lbs = (
int *)
palloc(elem_ndims *
sizeof(
int));
3075 memcpy(elem_lbs,
ARR_LBOUND(array), elem_ndims *
sizeof(
int));
3082 if (elem_ndims != this_ndims ||
3084 elem_ndims *
sizeof(
int)) != 0 ||
3086 elem_ndims *
sizeof(
int)) != 0)
3088 (
errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
3089 errmsg(
"multidimensional arrays must have array "
3090 "expressions with matching dimensions")));
3096 nbytes += subbytes[outer_nelems];
3100 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
3101 errmsg(
"array size exceeds the maximum allowed (%d)",
3123 (
errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
3124 errmsg(
"multidimensional arrays must have array "
3125 "expressions with matching dimensions")));
3129 dims[0] = outer_nelems;
3131 for (
int i = 1;
i < ndims;
i++)
3133 dims[
i] = elem_dims[
i - 1];
3134 lbs[
i] = elem_lbs[
i - 1];
3144 nbytes += dataoffset;
3154 result->
ndim = ndims;
3157 memcpy(
ARR_DIMS(result), dims, ndims *
sizeof(
int));
3158 memcpy(
ARR_LBOUND(result), lbs, ndims *
sizeof(
int));
3162 for (
int i = 0;
i < outer_nelems;
i++)
3164 memcpy(dat, subdata[
i], subbytes[
i]);
3170 iitem += subnitems[
i];
3191 arraydatum = *
op->resvalue;
3197 if (
op->d.arraycoerce.elemexprstate == NULL)
3211 op->d.arraycoerce.elemexprstate,
3213 op->d.arraycoerce.resultelemtype,
3214 op->d.arraycoerce.amstate);
3230 op->d.row.elemvalues,
3231 op->d.row.elemnulls);
3234 *
op->resnull =
false;
3247 bool *
nulls =
op->d.minmax.nulls;
3256 *
op->resnull =
true;
3258 for (
int off = 0; off <
op->d.minmax.nelems; off++)
3268 *
op->resnull =
false;
3283 if (cmpresult > 0 &&
operator ==
IS_LEAST)
3285 else if (cmpresult < 0 &&
operator ==
IS_GREATEST)
3312 tupDatum = *
op->resvalue;
3330 elog(
ERROR,
"unsupported reference to system column %d in FieldSelect",
3333 elog(
ERROR,
"attribute number %d exceeds number of columns %d",
3338 if (attr->attisdropped)
3340 *
op->resnull =
true;
3346 if (
op->d.fieldselect.resulttype != attr->atttypid)
3348 (
errcode(ERRCODE_DATATYPE_MISMATCH),
3350 errdetail(
"Table has type %s, but query expects %s.",
3368 &
op->d.fieldselect.rowcache, NULL);
3376 elog(
ERROR,
"unsupported reference to system column %d in FieldSelect",
3379 elog(
ERROR,
"attribute number %d exceeds number of columns %d",
3384 if (attr->attisdropped)
3386 *
op->resnull =
true;
3392 if (
op->d.fieldselect.resulttype != attr->atttypid)
3394 (
errcode(ERRCODE_DATATYPE_MISMATCH),
3396 errdetail(
"Table has type %s, but query expects %s.",
3427 memset(
op->d.fieldstore.nulls,
true,
3428 op->d.fieldstore.ncolumns *
sizeof(
bool));
3436 Datum tupDatum = *
op->resvalue;
3454 op->d.fieldstore.rowcache, NULL);
3458 elog(
ERROR,
"too many columns in composite type %u",
3459 op->d.fieldstore.fstore->resulttype);
3462 op->d.fieldstore.values,
3463 op->d.fieldstore.nulls);
3479 op->d.fieldstore.rowcache, NULL);
3482 op->d.fieldstore.values,
3483 op->d.fieldstore.nulls);
3486 *
op->resnull =
false;
3504 bool changed =
false;
3510 tupDatum = *
op->resvalue;
3519 op->d.convert_rowtype.incache,
3523 op->d.convert_rowtype.outcache,
3554 if (
op->d.convert_rowtype.map != NULL)
3594 bool useOr =
op->d.scalararrayop.useOr;
3595 bool strictfunc =
op->d.scalararrayop.finfo->fn_strict;
3627 *
op->resnull =
false;
3637 *
op->resnull =
true;
3648 &
op->d.scalararrayop.typlen,
3649 &
op->d.scalararrayop.typbyval,
3650 &
op->d.scalararrayop.typalign);
3654 typlen =
op->d.scalararrayop.typlen;
3673 if (bitmap && (*bitmap & bitmask) == 0)
3691 thisresult = (
Datum) 0;
3696 thisresult =
op->d.scalararrayop.fn_addr(fcinfo);
3725 if (bitmask == 0x100)
3733 *
op->resvalue = result;
3734 *
op->resnull = resultnull;
3750 fcinfo->args[0].value =
key;
3751 fcinfo->args[0].isnull =
false;
3770 fcinfo->args[0].value = key1;
3771 fcinfo->args[0].isnull =
false;
3772 fcinfo->args[1].value = key2;
3773 fcinfo->args[1].isnull =
false;
3798 bool inclause =
op->d.hashedscalararrayop.inclause;
3799 bool strictfunc =
op->d.hashedscalararrayop.finfo->fn_strict;
3815 *
op->resnull =
true;
3834 saop =
op->d.hashedscalararrayop.saop;
3879 if (bitmap && (*bitmap & bitmask) == 0)
3898 if (bitmask == 0x100)
3930 if (!hashfound &&
op->d.hashedscalararrayop.has_nulls)
3956 result =
op->d.hashedscalararrayop.finfo->fn_addr(fcinfo);
3957 resultnull = fcinfo->
isnull;
3968 *
op->resvalue = result;
3969 *
op->resnull = resultnull;
3980 (
errcode(ERRCODE_NOT_NULL_VIOLATION),
3981 errmsg(
"domain %s does not allow null values",
3992 if (!*
op->d.domaincheck.checknull &&
3995 (
errcode(ERRCODE_CHECK_VIOLATION),
3996 errmsg(
"value for domain %s violates check constraint \"%s\"",
3998 op->d.domaincheck.constraintname),
4000 op->d.domaincheck.constraintname)));
4015 *
op->resnull =
true;
4035 *
op->resnull =
false;
4043 bool *
argnull =
op->d.xmlexpr.named_argnull;
4065 *
op->resnull =
false;
4084 op->d.xmlexpr.named_argvalue,
4085 op->d.xmlexpr.named_argnull,
4086 op->d.xmlexpr.argvalue,
4087 op->d.xmlexpr.argnull));
4088 *
op->resnull =
false;
4096 bool preserve_whitespace;
4113 preserve_whitespace));
4114 *
op->resnull =
false;
4173 *
op->resnull =
false;
4193 *
op->resnull =
false;
4211 *
op->resnull =
false;
4216 elog(
ERROR,
"unrecognized XML operation");
4293 elog(
ERROR,
"invalid JsonConstructorExpr type %d", ctor->
type);
4295 *
op->resvalue =
res;
4318 if (exprtype == TEXTOID || exprtype == JSONOID)
4354 else if (exprtype == JSONBOID)
4436 !throw_error ? &
error : NULL,
4441 *
op->resnull =
false;
4449 !throw_error ? &
error : NULL,
4459 !throw_error ? &
error : NULL,
4467 *
op->resnull =
true;
4469 else if (!
error && !empty)
4480 *
op->resnull =
false;
4501 elog(
ERROR,
"unrecognized SQL/JSON expression op %d",
4514 Assert(jump_eval_coercion == -1);
4544 *
op->resnull =
true;
4570 errcode(ERRCODE_NO_SQL_JSON_ITEM),
4571 errmsg(
"no SQL/JSON item found for specified path of column \"%s\"",
4575 errcode(ERRCODE_NO_SQL_JSON_ITEM),
4576 errmsg(
"no SQL/JSON item found for specified path"));
4587 *
op->resnull =
true;
4620 memcpy(
str, item->
val.string.val, item->
val.string.len);
4621 str[item->
val.string.len] =
'\0';
4634 switch (item->
val.datetime.typid)
4638 item->
val.datetime.value));
4641 item->
val.datetime.value));
4644 item->
val.datetime.value));
4647 item->
val.datetime.value));
4648 case TIMESTAMPTZOID:
4650 item->
val.datetime.value));
4652 elog(
ERROR,
"unexpected jsonb datetime type oid %u",
4653 item->
val.datetime.typid);
4695 if (
op->d.jsonexpr_coercion.exists_coerce)
4697 if (
op->d.jsonexpr_coercion.exists_cast_to_int)
4700 if (
op->d.jsonexpr_coercion.exists_check_domain &&
4702 op->d.jsonexpr_coercion.targettype,
4703 &
op->d.jsonexpr_coercion.json_coercion_cache,
4707 *
op->resnull =
true;
4722 op->d.jsonexpr_coercion.targettype,
4723 op->d.jsonexpr_coercion.targettypmod,
4724 &
op->d.jsonexpr_coercion.json_coercion_cache,
4727 op->d.jsonexpr_coercion.omit_quotes,
4738 const char *behavior_names[] =
4774 (
errcode(ERRCODE_DATATYPE_MISMATCH),
4776 errmsg(
"could not coerce %s expression (%s) to the RETURNING type",
4782 (
errcode(ERRCODE_DATATYPE_MISMATCH),
4784 errmsg(
"could not coerce %s expression (%s) to the RETURNING type",
4790 *
op->resnull =
true;
4821 foreach(lc,
op->d.grouping_func.clauses)
4832 *
op->resnull =
false;
4848 elog(
ERROR,
"no merge action in progress");
4855 *
op->resnull =
false;
4859 *
op->resnull =
false;
4863 *
op->resnull =
false;
4866 elog(
ERROR,
"unexpected merge action: DO NOTHING");
4869 elog(
ERROR,
"unrecognized commandType: %d",
4929 if (
op->d.wholerow.junkFilter != NULL)
4939 if (
op->d.wholerow.first)
4942 op->d.wholerow.slow =
false;
4948 if (
variable->vartype != RECORDOID)
4973 if (var_tupdesc->
natts != slot_tupdesc->
natts)
4975 (
errcode(ERRCODE_DATATYPE_MISMATCH),
4976 errmsg(
"table row type and query-specified row type do not match"),
4978 "Table row contains %d attributes, but query expects %d.",
4979 slot_tupdesc->
natts,
4980 slot_tupdesc->
natts,
4981 var_tupdesc->
natts)));
4983 for (
int i = 0;
i < var_tupdesc->
natts;
i++)
4988 if (vattr->atttypid == sattr->atttypid)
4990 if (!vattr->attisdropped)
4992 (
errcode(ERRCODE_DATATYPE_MISMATCH),
4993 errmsg(
"table row type and query-specified row type do not match"),
4994 errdetail(
"Table has type %s at ordinal position %d, but query expects %s.",
4999 if (vattr->attlen != sattr->attlen ||
5000 vattr->attalign != sattr->attalign)
5001 op->d.wholerow.slow =
true;
5031 output_tupdesc->
tdtypeid = RECORDOID;
5062 op->d.wholerow.first =
false;
5071 if (
op->d.wholerow.slow)
5079 for (
int i = 0;
i < var_tupdesc->
natts;
i++)
5084 if (!vattr->attisdropped)
5088 if (vattr->attlen != sattr->attlen ||
5089 vattr->attalign != sattr->attalign)
5091 (
errcode(ERRCODE_DATATYPE_MISMATCH),
5092 errmsg(
"table row type and query-specified row type do not match"),
5093 errdetail(
"Physical storage mismatch on dropped attribute at ordinal position %d.",
5118 *
op->resnull =
false;
5134 elog(
ERROR,
"failed to fetch attribute from slot");
5196 Datum newValue,
bool newValueIsNull,
5197 Datum oldValue,
bool oldValueIsNull)
5199 Assert(newValue != oldValue);
5201 if (!newValueIsNull)
5221 newValue = (
Datum) 0;
5224 if (!oldValueIsNull)
5290 bool isdistinct =
false;
5338 int setno =
op->d.agg_trans.setno;
5341 *
op->resvalue, *
op->resnull);