From c04f20851266020f06c313a100de05c6dedbeca3 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 22 Sep 2025 14:47:49 +0200 Subject: [PATCH 22/23] C11 anonymous unions [executor] --- contrib/hstore/hstore_subs.c | 4 +- src/backend/executor/execExpr.c | 670 ++++++++++++------------- src/backend/executor/execExprInterp.c | 680 +++++++++++++------------- src/backend/utils/adt/arraysubs.c | 14 +- src/backend/utils/adt/jsonbsubs.c | 8 +- src/include/executor/execExpr.h | 2 +- src/pl/plpgsql/src/pl_exec.c | 78 +-- 7 files changed, 728 insertions(+), 728 deletions(-) diff --git a/contrib/hstore/hstore_subs.c b/contrib/hstore/hstore_subs.c index 3d03f66fa0d..8342d1ca558 100644 --- a/contrib/hstore/hstore_subs.c +++ b/contrib/hstore/hstore_subs.c @@ -95,7 +95,7 @@ hstore_subscript_fetch(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - SubscriptingRefState *sbsrefstate = op->d.sbsref.state; + SubscriptingRefState *sbsrefstate = op->sbsref.state; HStore *hs; text *key; HEntry *entries; @@ -144,7 +144,7 @@ hstore_subscript_assign(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - SubscriptingRefState *sbsrefstate = op->d.sbsref.state; + SubscriptingRefState *sbsrefstate = op->sbsref.state; text *key; Pairs p; HStore *out; diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c index f1569879b52..a3490cb3d9c 100644 --- a/src/backend/executor/execExpr.c +++ b/src/backend/executor/execExpr.c @@ -270,7 +270,7 @@ ExecInitQual(List *qual, PlanState *parent) ExecInitExprRec(node, state, &state->resvalue, &state->resnull); /* then emit EEOP_QUAL to detect if it's false (or null) */ - scratch.d.qualexpr.jumpdone = -1; + scratch.qualexpr.jumpdone = -1; ExprEvalPushStep(state, &scratch); adjust_jumps = lappend_int(adjust_jumps, state->steps_len - 1); @@ -282,8 +282,8 @@ ExecInitQual(List *qual, PlanState *parent) ExprEvalStep *as = &state->steps[jump]; Assert(as->opcode == EEOP_QUAL); - Assert(as->d.qualexpr.jumpdone == -1); - as->d.qualexpr.jumpdone = state->steps_len; + Assert(as->qualexpr.jumpdone == -1); + as->qualexpr.jumpdone = state->steps_len; } /* @@ -473,8 +473,8 @@ ExecBuildProjectionInfo(List *targetList, break; } - scratch.d.assign_var.attnum = attnum - 1; - scratch.d.assign_var.resultnum = tle->resno - 1; + scratch.assign_var.attnum = attnum - 1; + scratch.assign_var.resultnum = tle->resno - 1; ExprEvalPushStep(state, &scratch); } else @@ -498,7 +498,7 @@ ExecBuildProjectionInfo(List *targetList, scratch.opcode = EEOP_ASSIGN_TMP_MAKE_RO; else scratch.opcode = EEOP_ASSIGN_TMP; - scratch.d.assign_tmp.resultnum = tle->resno - 1; + scratch.assign_tmp.resultnum = tle->resno - 1; ExprEvalPushStep(state, &scratch); } } @@ -696,15 +696,15 @@ ExecBuildUpdateProjection(List *targetList, &state->resvalue, &state->resnull); /* Needn't worry about read-only-ness here, either. */ scratch.opcode = EEOP_ASSIGN_TMP; - scratch.d.assign_tmp.resultnum = targetattnum - 1; + scratch.assign_tmp.resultnum = targetattnum - 1; ExprEvalPushStep(state, &scratch); } else { /* Just assign from the outer tuple. */ scratch.opcode = EEOP_ASSIGN_OUTER_VAR; - scratch.d.assign_var.attnum = outerattnum; - scratch.d.assign_var.resultnum = targetattnum - 1; + scratch.assign_var.attnum = outerattnum; + scratch.assign_var.resultnum = targetattnum - 1; ExprEvalPushStep(state, &scratch); } outerattnum++; @@ -724,20 +724,20 @@ ExecBuildUpdateProjection(List *targetList, scratch.opcode = EEOP_CONST; scratch.resvalue = &state->resvalue; scratch.resnull = &state->resnull; - scratch.d.constval.value = (Datum) 0; - scratch.d.constval.isnull = true; + scratch.constval.value = (Datum) 0; + scratch.constval.isnull = true; ExprEvalPushStep(state, &scratch); /* ... then assign it to the result slot */ scratch.opcode = EEOP_ASSIGN_TMP; - scratch.d.assign_tmp.resultnum = attnum - 1; + scratch.assign_tmp.resultnum = attnum - 1; ExprEvalPushStep(state, &scratch); } else if (!bms_is_member(attnum, assignedCols)) { /* Certainly the right type, so needn't check */ scratch.opcode = EEOP_ASSIGN_SCAN_VAR; - scratch.d.assign_var.attnum = attnum - 1; - scratch.d.assign_var.resultnum = attnum - 1; + scratch.assign_var.attnum = attnum - 1; + scratch.assign_var.resultnum = attnum - 1; ExprEvalPushStep(state, &scratch); } } @@ -944,9 +944,9 @@ ExecInitExprRec(Expr *node, ExprState *state, else if (variable->varattno <= 0) { /* system column */ - scratch.d.var.attnum = variable->varattno; - scratch.d.var.vartype = variable->vartype; - scratch.d.var.varreturningtype = variable->varreturningtype; + scratch.var.attnum = variable->varattno; + scratch.var.vartype = variable->vartype; + scratch.var.varreturningtype = variable->varreturningtype; switch (variable->varno) { case INNER_VAR: @@ -979,9 +979,9 @@ ExecInitExprRec(Expr *node, ExprState *state, else { /* regular user column */ - scratch.d.var.attnum = variable->varattno - 1; - scratch.d.var.vartype = variable->vartype; - scratch.d.var.varreturningtype = variable->varreturningtype; + scratch.var.attnum = variable->varattno - 1; + scratch.var.vartype = variable->vartype; + scratch.var.varreturningtype = variable->varreturningtype; switch (variable->varno) { case INNER_VAR: @@ -1021,8 +1021,8 @@ ExecInitExprRec(Expr *node, ExprState *state, Const *con = (Const *) node; scratch.opcode = EEOP_CONST; - scratch.d.constval.value = con->constvalue; - scratch.d.constval.isnull = con->constisnull; + scratch.constval.value = con->constvalue; + scratch.constval.isnull = con->constisnull; ExprEvalPushStep(state, &scratch); break; @@ -1037,8 +1037,8 @@ ExecInitExprRec(Expr *node, ExprState *state, { case PARAM_EXEC: scratch.opcode = EEOP_PARAM_EXEC; - scratch.d.param.paramid = param->paramid; - scratch.d.param.paramtype = param->paramtype; + scratch.param.paramid = param->paramid; + scratch.param.paramtype = param->paramtype; ExprEvalPushStep(state, &scratch); break; case PARAM_EXTERN: @@ -1064,8 +1064,8 @@ ExecInitExprRec(Expr *node, ExprState *state, else { scratch.opcode = EEOP_PARAM_EXTERN; - scratch.d.param.paramid = param->paramid; - scratch.d.param.paramtype = param->paramtype; + scratch.param.paramid = param->paramid; + scratch.param.paramtype = param->paramtype; ExprEvalPushStep(state, &scratch); } break; @@ -1082,7 +1082,7 @@ ExecInitExprRec(Expr *node, ExprState *state, Aggref *aggref = (Aggref *) node; scratch.opcode = EEOP_AGGREF; - scratch.d.aggref.aggno = aggref->aggno; + scratch.aggref.aggno = aggref->aggno; if (state->parent && IsA(state->parent, AggState)) { @@ -1114,9 +1114,9 @@ ExecInitExprRec(Expr *node, ExprState *state, agg = (Agg *) (state->parent->plan); if (agg->groupingSets) - scratch.d.grouping_func.clauses = grp_node->cols; + scratch.grouping_func.clauses = grp_node->cols; else - scratch.d.grouping_func.clauses = NIL; + scratch.grouping_func.clauses = NIL; ExprEvalPushStep(state, &scratch); break; @@ -1163,7 +1163,7 @@ ExecInitExprRec(Expr *node, ExprState *state, } scratch.opcode = EEOP_WINDOW_FUNC; - scratch.d.window_func.wfstate = wfstate; + scratch.window_func.wfstate = wfstate; ExprEvalPushStep(state, &scratch); break; } @@ -1246,7 +1246,7 @@ ExecInitExprRec(Expr *node, ExprState *state, * that the value passed to the comparison function is a * read-only pointer. */ - scratch.d.func.make_ro = + scratch.func.make_ro = (get_typlen(exprType((Node *) linitial(op->args))) == -1); /* @@ -1343,10 +1343,10 @@ ExecInitExprRec(Expr *node, ExprState *state, /* And perform the operation */ scratch.opcode = EEOP_HASHED_SCALARARRAYOP; - scratch.d.hashedscalararrayop.inclause = opexpr->useOr; - scratch.d.hashedscalararrayop.finfo = finfo; - scratch.d.hashedscalararrayop.fcinfo_data = fcinfo; - scratch.d.hashedscalararrayop.saop = opexpr; + scratch.hashedscalararrayop.inclause = opexpr->useOr; + scratch.hashedscalararrayop.finfo = finfo; + scratch.hashedscalararrayop.fcinfo_data = fcinfo; + scratch.hashedscalararrayop.saop = opexpr; ExprEvalPushStep(state, &scratch); @@ -1368,11 +1368,11 @@ ExecInitExprRec(Expr *node, ExprState *state, /* And perform the operation */ scratch.opcode = EEOP_SCALARARRAYOP; - scratch.d.scalararrayop.element_type = InvalidOid; - scratch.d.scalararrayop.useOr = opexpr->useOr; - scratch.d.scalararrayop.finfo = finfo; - scratch.d.scalararrayop.fcinfo_data = fcinfo; - scratch.d.scalararrayop.fn_addr = finfo->fn_addr; + scratch.scalararrayop.element_type = InvalidOid; + scratch.scalararrayop.useOr = opexpr->useOr; + scratch.scalararrayop.finfo = finfo; + scratch.scalararrayop.fcinfo_data = fcinfo; + scratch.scalararrayop.fn_addr = finfo->fn_addr; ExprEvalPushStep(state, &scratch); } break; @@ -1388,7 +1388,7 @@ ExecInitExprRec(Expr *node, ExprState *state, /* allocate scratch memory used by all steps of AND/OR */ if (boolexpr->boolop != NOT_EXPR) - scratch.d.boolexpr.anynull = (bool *) palloc(sizeof(bool)); + scratch.boolexpr.anynull = (bool *) palloc(sizeof(bool)); /* * For each argument evaluate the argument itself, then @@ -1445,7 +1445,7 @@ ExecInitExprRec(Expr *node, ExprState *state, break; } - scratch.d.boolexpr.jumpdone = -1; + scratch.boolexpr.jumpdone = -1; ExprEvalPushStep(state, &scratch); adjust_jumps = lappend_int(adjust_jumps, state->steps_len - 1); @@ -1457,8 +1457,8 @@ ExecInitExprRec(Expr *node, ExprState *state, { ExprEvalStep *as = &state->steps[lfirst_int(lc)]; - Assert(as->d.boolexpr.jumpdone == -1); - as->d.boolexpr.jumpdone = state->steps_len; + Assert(as->boolexpr.jumpdone == -1); + as->boolexpr.jumpdone = state->steps_len; } break; @@ -1477,8 +1477,8 @@ ExecInitExprRec(Expr *node, ExprState *state, if (subplan->subLinkType == MULTIEXPR_SUBLINK) { scratch.opcode = EEOP_CONST; - scratch.d.constval.value = (Datum) 0; - scratch.d.constval.isnull = true; + scratch.constval.value = (Datum) 0; + scratch.constval.isnull = true; ExprEvalPushStep(state, &scratch); break; } @@ -1496,9 +1496,9 @@ ExecInitExprRec(Expr *node, ExprState *state, /* and extract field */ scratch.opcode = EEOP_FIELDSELECT; - scratch.d.fieldselect.fieldnum = fselect->fieldnum; - scratch.d.fieldselect.resulttype = fselect->resulttype; - scratch.d.fieldselect.rowcache.cacheptr = NULL; + scratch.fieldselect.fieldnum = fselect->fieldnum; + scratch.fieldselect.resulttype = fselect->resulttype; + scratch.fieldselect.rowcache.cacheptr = NULL; ExprEvalPushStep(state, &scratch); break; @@ -1533,11 +1533,11 @@ ExecInitExprRec(Expr *node, ExprState *state, /* next, deform the input tuple into our workspace */ scratch.opcode = EEOP_FIELDSTORE_DEFORM; - scratch.d.fieldstore.fstore = fstore; - scratch.d.fieldstore.rowcache = rowcachep; - scratch.d.fieldstore.values = values; - scratch.d.fieldstore.nulls = nulls; - scratch.d.fieldstore.ncolumns = ncolumns; + scratch.fieldstore.fstore = fstore; + scratch.fieldstore.rowcache = rowcachep; + scratch.fieldstore.values = values; + scratch.fieldstore.nulls = nulls; + scratch.fieldstore.ncolumns = ncolumns; ExprEvalPushStep(state, &scratch); /* evaluate new field values, store in workspace columns */ @@ -1591,11 +1591,11 @@ ExecInitExprRec(Expr *node, ExprState *state, /* finally, form result tuple */ scratch.opcode = EEOP_FIELDSTORE_FORM; - scratch.d.fieldstore.fstore = fstore; - scratch.d.fieldstore.rowcache = rowcachep; - scratch.d.fieldstore.values = values; - scratch.d.fieldstore.nulls = nulls; - scratch.d.fieldstore.ncolumns = ncolumns; + scratch.fieldstore.fstore = fstore; + scratch.fieldstore.rowcache = rowcachep; + scratch.fieldstore.values = values; + scratch.fieldstore.nulls = nulls; + scratch.fieldstore.ncolumns = ncolumns; ExprEvalPushStep(state, &scratch); break; } @@ -1634,34 +1634,34 @@ ExecInitExprRec(Expr *node, ExprState *state, scratch.opcode = EEOP_IOCOERCE_SAFE; /* lookup the source type's output function */ - scratch.d.iocoerce.finfo_out = palloc0(sizeof(FmgrInfo)); - scratch.d.iocoerce.fcinfo_data_out = palloc0(SizeForFunctionCallInfo(1)); + scratch.iocoerce.finfo_out = palloc0(sizeof(FmgrInfo)); + scratch.iocoerce.fcinfo_data_out = palloc0(SizeForFunctionCallInfo(1)); getTypeOutputInfo(exprType((Node *) iocoerce->arg), &iofunc, &typisvarlena); - fmgr_info(iofunc, scratch.d.iocoerce.finfo_out); - fmgr_info_set_expr((Node *) node, scratch.d.iocoerce.finfo_out); - InitFunctionCallInfoData(*scratch.d.iocoerce.fcinfo_data_out, - scratch.d.iocoerce.finfo_out, + fmgr_info(iofunc, scratch.iocoerce.finfo_out); + fmgr_info_set_expr((Node *) node, scratch.iocoerce.finfo_out); + InitFunctionCallInfoData(*scratch.iocoerce.fcinfo_data_out, + scratch.iocoerce.finfo_out, 1, InvalidOid, NULL, NULL); /* lookup the result type's input function */ - scratch.d.iocoerce.finfo_in = palloc0(sizeof(FmgrInfo)); - scratch.d.iocoerce.fcinfo_data_in = palloc0(SizeForFunctionCallInfo(3)); + scratch.iocoerce.finfo_in = palloc0(sizeof(FmgrInfo)); + scratch.iocoerce.fcinfo_data_in = palloc0(SizeForFunctionCallInfo(3)); getTypeInputInfo(iocoerce->resulttype, &iofunc, &typioparam); - fmgr_info(iofunc, scratch.d.iocoerce.finfo_in); - fmgr_info_set_expr((Node *) node, scratch.d.iocoerce.finfo_in); - InitFunctionCallInfoData(*scratch.d.iocoerce.fcinfo_data_in, - scratch.d.iocoerce.finfo_in, + fmgr_info(iofunc, scratch.iocoerce.finfo_in); + fmgr_info_set_expr((Node *) node, scratch.iocoerce.finfo_in); + InitFunctionCallInfoData(*scratch.iocoerce.fcinfo_data_in, + scratch.iocoerce.finfo_in, 3, InvalidOid, NULL, NULL); /* * We can preload the second and third arguments for the input * function, since they're constants. */ - fcinfo_in = scratch.d.iocoerce.fcinfo_data_in; + fcinfo_in = scratch.iocoerce.fcinfo_data_in; fcinfo_in->args[1].value = ObjectIdGetDatum(typioparam); fcinfo_in->args[1].isnull = false; fcinfo_in->args[2].value = Int32GetDatum(-1); @@ -1721,19 +1721,19 @@ ExecInitExprRec(Expr *node, ExprState *state, } scratch.opcode = EEOP_ARRAYCOERCE; - scratch.d.arraycoerce.elemexprstate = elemstate; - scratch.d.arraycoerce.resultelemtype = resultelemtype; + scratch.arraycoerce.elemexprstate = elemstate; + scratch.arraycoerce.resultelemtype = resultelemtype; if (elemstate) { /* Set up workspace for array_map */ - scratch.d.arraycoerce.amstate = + scratch.arraycoerce.amstate = (ArrayMapState *) palloc0(sizeof(ArrayMapState)); } else { /* Don't need workspace if there's no subexpression */ - scratch.d.arraycoerce.amstate = NULL; + scratch.arraycoerce.amstate = NULL; } ExprEvalPushStep(state, &scratch); @@ -1755,12 +1755,12 @@ ExecInitExprRec(Expr *node, ExprState *state, /* and push conversion step */ scratch.opcode = EEOP_CONVERT_ROWTYPE; - scratch.d.convert_rowtype.inputtype = + scratch.convert_rowtype.inputtype = exprType((Node *) convert->arg); - scratch.d.convert_rowtype.outputtype = convert->resulttype; - scratch.d.convert_rowtype.incache = &rowcachep[0]; - scratch.d.convert_rowtype.outcache = &rowcachep[1]; - scratch.d.convert_rowtype.map = NULL; + scratch.convert_rowtype.outputtype = convert->resulttype; + scratch.convert_rowtype.incache = &rowcachep[0]; + scratch.convert_rowtype.outcache = &rowcachep[1]; + scratch.convert_rowtype.map = NULL; ExprEvalPushStep(state, &scratch); break; @@ -1799,8 +1799,8 @@ ExecInitExprRec(Expr *node, ExprState *state, scratch.opcode = EEOP_MAKE_READONLY; scratch.resvalue = caseval; scratch.resnull = casenull; - scratch.d.make_readonly.value = caseval; - scratch.d.make_readonly.isnull = casenull; + scratch.make_readonly.value = caseval; + scratch.make_readonly.isnull = casenull; ExprEvalPushStep(state, &scratch); /* restore normal settings of scratch fields */ scratch.resvalue = resv; @@ -1844,7 +1844,7 @@ ExecInitExprRec(Expr *node, ExprState *state, /* If WHEN result isn't true, jump to next CASE arm */ scratch.opcode = EEOP_JUMP_IF_NOT_TRUE; - scratch.d.jump.jumpdone = -1; /* computed later */ + scratch.jump.jumpdone = -1; /* computed later */ ExprEvalPushStep(state, &scratch); whenstep = state->steps_len - 1; @@ -1856,7 +1856,7 @@ ExecInitExprRec(Expr *node, ExprState *state, /* Emit JUMP step to jump to end of CASE's code */ scratch.opcode = EEOP_JUMP; - scratch.d.jump.jumpdone = -1; /* computed later */ + scratch.jump.jumpdone = -1; /* computed later */ ExprEvalPushStep(state, &scratch); /* @@ -1870,7 +1870,7 @@ ExecInitExprRec(Expr *node, ExprState *state, * But we can set WHEN test's jump target now, to make it * jump to the next WHEN subexpression or the ELSE. */ - state->steps[whenstep].d.jump.jumpdone = state->steps_len; + state->steps[whenstep].jump.jumpdone = state->steps_len; } /* transformCaseExpr always adds a default */ @@ -1886,8 +1886,8 @@ ExecInitExprRec(Expr *node, ExprState *state, ExprEvalStep *as = &state->steps[lfirst_int(lc)]; Assert(as->opcode == EEOP_JUMP); - Assert(as->d.jump.jumpdone == -1); - as->d.jump.jumpdone = state->steps_len; + Assert(as->jump.jumpdone == -1); + as->jump.jumpdone = state->steps_len; } break; @@ -1909,8 +1909,8 @@ ExecInitExprRec(Expr *node, ExprState *state, else { scratch.opcode = EEOP_CASE_TESTVAL; - scratch.d.casetest.value = state->innermost_caseval; - scratch.d.casetest.isnull = state->innermost_casenull; + scratch.casetest.value = state->innermost_caseval; + scratch.casetest.isnull = state->innermost_casenull; } ExprEvalPushStep(state, &scratch); break; @@ -1929,21 +1929,21 @@ ExecInitExprRec(Expr *node, ExprState *state, * associated with the ARRAYEXPR step. */ scratch.opcode = EEOP_ARRAYEXPR; - scratch.d.arrayexpr.elemvalues = + scratch.arrayexpr.elemvalues = (Datum *) palloc(sizeof(Datum) * nelems); - scratch.d.arrayexpr.elemnulls = + scratch.arrayexpr.elemnulls = (bool *) palloc(sizeof(bool) * nelems); - scratch.d.arrayexpr.nelems = nelems; + scratch.arrayexpr.nelems = nelems; /* fill remaining fields of step */ - scratch.d.arrayexpr.multidims = arrayexpr->multidims; - scratch.d.arrayexpr.elemtype = arrayexpr->element_typeid; + scratch.arrayexpr.multidims = arrayexpr->multidims; + scratch.arrayexpr.elemtype = arrayexpr->element_typeid; /* do one-time catalog lookup for type info */ get_typlenbyvalalign(arrayexpr->element_typeid, - &scratch.d.arrayexpr.elemlength, - &scratch.d.arrayexpr.elembyval, - &scratch.d.arrayexpr.elemalign); + &scratch.arrayexpr.elemlength, + &scratch.arrayexpr.elembyval, + &scratch.arrayexpr.elemalign); /* prepare to evaluate all arguments */ elemoff = 0; @@ -1952,8 +1952,8 @@ ExecInitExprRec(Expr *node, ExprState *state, Expr *e = (Expr *) lfirst(lc); ExecInitExprRec(e, state, - &scratch.d.arrayexpr.elemvalues[elemoff], - &scratch.d.arrayexpr.elemnulls[elemoff]); + &scratch.arrayexpr.elemvalues[elemoff], + &scratch.arrayexpr.elemnulls[elemoff]); elemoff++; } @@ -2002,15 +2002,15 @@ ExecInitExprRec(Expr *node, ExprState *state, * a final step forming the composite datum. */ scratch.opcode = EEOP_ROW; - scratch.d.row.tupdesc = tupdesc; + scratch.row.tupdesc = tupdesc; /* space for the individual field datums */ - scratch.d.row.elemvalues = + scratch.row.elemvalues = (Datum *) palloc(sizeof(Datum) * nelems); - scratch.d.row.elemnulls = + scratch.row.elemnulls = (bool *) palloc(sizeof(bool) * nelems); /* as explained above, make sure any extra columns are null */ - memset(scratch.d.row.elemnulls, true, sizeof(bool) * nelems); + memset(scratch.row.elemnulls, true, sizeof(bool) * nelems); /* Set up evaluation, skipping any deleted columns */ i = 0; @@ -2046,8 +2046,8 @@ ExecInitExprRec(Expr *node, ExprState *state, /* Evaluate column expr into appropriate workspace slot */ ExecInitExprRec(e, state, - &scratch.d.row.elemvalues[i], - &scratch.d.row.elemnulls[i]); + &scratch.row.elemvalues[i], + &scratch.row.elemnulls[i]); i++; } @@ -2130,12 +2130,12 @@ ExecInitExprRec(Expr *node, ExprState *state, &fcinfo->args[1].value, &fcinfo->args[1].isnull); scratch.opcode = EEOP_ROWCOMPARE_STEP; - scratch.d.rowcompare_step.finfo = finfo; - scratch.d.rowcompare_step.fcinfo_data = fcinfo; - scratch.d.rowcompare_step.fn_addr = finfo->fn_addr; + scratch.rowcompare_step.finfo = finfo; + scratch.rowcompare_step.fcinfo_data = fcinfo; + scratch.rowcompare_step.fn_addr = finfo->fn_addr; /* jump targets filled below */ - scratch.d.rowcompare_step.jumpnull = -1; - scratch.d.rowcompare_step.jumpdone = -1; + scratch.rowcompare_step.jumpnull = -1; + scratch.rowcompare_step.jumpdone = -1; ExprEvalPushStep(state, &scratch); adjust_jumps = lappend_int(adjust_jumps, @@ -2149,14 +2149,14 @@ ExecInitExprRec(Expr *node, ExprState *state, if (nopers == 0) { scratch.opcode = EEOP_CONST; - scratch.d.constval.value = Int32GetDatum(0); - scratch.d.constval.isnull = false; + scratch.constval.value = Int32GetDatum(0); + scratch.constval.isnull = false; ExprEvalPushStep(state, &scratch); } /* Finally, examine the last comparison result */ scratch.opcode = EEOP_ROWCOMPARE_FINAL; - scratch.d.rowcompare_final.cmptype = rcexpr->cmptype; + scratch.rowcompare_final.cmptype = rcexpr->cmptype; ExprEvalPushStep(state, &scratch); /* adjust jump targets */ @@ -2165,13 +2165,13 @@ ExecInitExprRec(Expr *node, ExprState *state, ExprEvalStep *as = &state->steps[lfirst_int(lc)]; Assert(as->opcode == EEOP_ROWCOMPARE_STEP); - Assert(as->d.rowcompare_step.jumpdone == -1); - Assert(as->d.rowcompare_step.jumpnull == -1); + Assert(as->rowcompare_step.jumpdone == -1); + Assert(as->rowcompare_step.jumpnull == -1); /* jump to comparison evaluation */ - as->d.rowcompare_step.jumpdone = state->steps_len - 1; + as->rowcompare_step.jumpdone = state->steps_len - 1; /* jump to the following expression */ - as->d.rowcompare_step.jumpnull = state->steps_len; + as->rowcompare_step.jumpnull = state->steps_len; } break; @@ -2199,7 +2199,7 @@ ExecInitExprRec(Expr *node, ExprState *state, /* if it's not null, skip to end of COALESCE expr */ scratch.opcode = EEOP_JUMP_IF_NOT_NULL; - scratch.d.jump.jumpdone = -1; /* adjust later */ + scratch.jump.jumpdone = -1; /* adjust later */ ExprEvalPushStep(state, &scratch); adjust_jumps = lappend_int(adjust_jumps, @@ -2218,8 +2218,8 @@ ExecInitExprRec(Expr *node, ExprState *state, ExprEvalStep *as = &state->steps[lfirst_int(lc)]; Assert(as->opcode == EEOP_JUMP_IF_NOT_NULL); - Assert(as->d.jump.jumpdone == -1); - as->d.jump.jumpdone = state->steps_len; + Assert(as->jump.jumpdone == -1); + as->jump.jumpdone = state->steps_len; } break; @@ -2261,15 +2261,15 @@ ExecInitExprRec(Expr *node, ExprState *state, scratch.opcode = EEOP_MINMAX; /* allocate space to store arguments */ - scratch.d.minmax.values = + scratch.minmax.values = (Datum *) palloc(sizeof(Datum) * nelems); - scratch.d.minmax.nulls = + scratch.minmax.nulls = (bool *) palloc(sizeof(bool) * nelems); - scratch.d.minmax.nelems = nelems; + scratch.minmax.nelems = nelems; - scratch.d.minmax.op = minmaxexpr->op; - scratch.d.minmax.finfo = finfo; - scratch.d.minmax.fcinfo_data = fcinfo; + scratch.minmax.op = minmaxexpr->op; + scratch.minmax.finfo = finfo; + scratch.minmax.fcinfo_data = fcinfo; /* evaluate expressions into minmax->values/nulls */ off = 0; @@ -2278,8 +2278,8 @@ ExecInitExprRec(Expr *node, ExprState *state, Expr *e = (Expr *) lfirst(lc); ExecInitExprRec(e, state, - &scratch.d.minmax.values[off], - &scratch.d.minmax.nulls[off]); + &scratch.minmax.values[off], + &scratch.minmax.nulls[off]); off++; } @@ -2293,7 +2293,7 @@ ExecInitExprRec(Expr *node, ExprState *state, SQLValueFunction *svf = (SQLValueFunction *) node; scratch.opcode = EEOP_SQLVALUEFUNCTION; - scratch.d.sqlvaluefunction.svf = svf; + scratch.sqlvaluefunction.svf = svf; ExprEvalPushStep(state, &scratch); break; @@ -2308,33 +2308,33 @@ ExecInitExprRec(Expr *node, ExprState *state, ListCell *arg; scratch.opcode = EEOP_XMLEXPR; - scratch.d.xmlexpr.xexpr = xexpr; + scratch.xmlexpr.xexpr = xexpr; /* allocate space for storing all the arguments */ if (nnamed) { - scratch.d.xmlexpr.named_argvalue = + scratch.xmlexpr.named_argvalue = (Datum *) palloc(sizeof(Datum) * nnamed); - scratch.d.xmlexpr.named_argnull = + scratch.xmlexpr.named_argnull = (bool *) palloc(sizeof(bool) * nnamed); } else { - scratch.d.xmlexpr.named_argvalue = NULL; - scratch.d.xmlexpr.named_argnull = NULL; + scratch.xmlexpr.named_argvalue = NULL; + scratch.xmlexpr.named_argnull = NULL; } if (nargs) { - scratch.d.xmlexpr.argvalue = + scratch.xmlexpr.argvalue = (Datum *) palloc(sizeof(Datum) * nargs); - scratch.d.xmlexpr.argnull = + scratch.xmlexpr.argnull = (bool *) palloc(sizeof(bool) * nargs); } else { - scratch.d.xmlexpr.argvalue = NULL; - scratch.d.xmlexpr.argnull = NULL; + scratch.xmlexpr.argvalue = NULL; + scratch.xmlexpr.argnull = NULL; } /* prepare argument execution */ @@ -2344,8 +2344,8 @@ ExecInitExprRec(Expr *node, ExprState *state, Expr *e = (Expr *) lfirst(arg); ExecInitExprRec(e, state, - &scratch.d.xmlexpr.named_argvalue[off], - &scratch.d.xmlexpr.named_argnull[off]); + &scratch.xmlexpr.named_argvalue[off], + &scratch.xmlexpr.named_argnull[off]); off++; } @@ -2355,8 +2355,8 @@ ExecInitExprRec(Expr *node, ExprState *state, Expr *e = (Expr *) lfirst(arg); ExecInitExprRec(e, state, - &scratch.d.xmlexpr.argvalue[off], - &scratch.d.xmlexpr.argnull[off]); + &scratch.xmlexpr.argvalue[off], + &scratch.xmlexpr.argnull[off]); off++; } @@ -2401,7 +2401,7 @@ ExecInitExprRec(Expr *node, ExprState *state, jcstate = palloc0(sizeof(JsonConstructorExprState)); scratch.opcode = EEOP_JSON_CONSTRUCTOR; - scratch.d.json_constructor.jcstate = jcstate; + scratch.json_constructor.jcstate = jcstate; jcstate->constructor = ctor; jcstate->arg_values = (Datum *) palloc(sizeof(Datum) * nargs); @@ -2481,7 +2481,7 @@ ExecInitExprRec(Expr *node, ExprState *state, ExecInitExprRec((Expr *) pred->expr, state, resv, resnull); scratch.opcode = EEOP_IS_JSON; - scratch.d.is_json.pred = pred; + scratch.is_json.pred = pred; ExprEvalPushStep(state, &scratch); break; @@ -2528,7 +2528,7 @@ ExecInitExprRec(Expr *node, ExprState *state, (int) ntest->nulltesttype); } /* initialize cache in case it's a row test */ - scratch.d.nulltest_row.rowcache.cacheptr = NULL; + scratch.nulltest_row.rowcache.cacheptr = NULL; /* first evaluate argument into result variable */ ExecInitExprRec(ntest->arg, state, @@ -2607,8 +2607,8 @@ ExecInitExprRec(Expr *node, ExprState *state, { scratch.opcode = EEOP_DOMAIN_TESTVAL; /* we share instruction union variant with case testval */ - scratch.d.casetest.value = state->innermost_domainval; - scratch.d.casetest.isnull = state->innermost_domainnull; + scratch.casetest.value = state->innermost_domainval; + scratch.casetest.isnull = state->innermost_domainnull; } ExprEvalPushStep(state, &scratch); break; @@ -2626,8 +2626,8 @@ ExecInitExprRec(Expr *node, ExprState *state, NextValueExpr *nve = (NextValueExpr *) node; scratch.opcode = EEOP_NEXTVALUEEXPR; - scratch.d.nextvalueexpr.seqid = nve->seqid; - scratch.d.nextvalueexpr.seqtypid = nve->typeId; + scratch.nextvalueexpr.seqid = nve->seqid; + scratch.nextvalueexpr.seqtypid = nve->typeId; ExprEvalPushStep(state, &scratch); break; @@ -2640,9 +2640,9 @@ ExecInitExprRec(Expr *node, ExprState *state, /* Skip expression evaluation if OLD/NEW row doesn't exist */ scratch.opcode = EEOP_RETURNINGEXPR; - scratch.d.returningexpr.nullflag = rexpr->retold ? + scratch.returningexpr.nullflag = rexpr->retold ? EEO_FLAG_OLD_IS_NULL : EEO_FLAG_NEW_IS_NULL; - scratch.d.returningexpr.jumpdone = -1; /* set below */ + scratch.returningexpr.jumpdone = -1; /* set below */ ExprEvalPushStep(state, &scratch); retstep = state->steps_len - 1; @@ -2650,7 +2650,7 @@ ExecInitExprRec(Expr *node, ExprState *state, ExecInitExprRec(rexpr->retexpr, state, resv, resnull); /* Jump target used if OLD/NEW row doesn't exist */ - state->steps[retstep].d.returningexpr.jumpdone = state->steps_len; + state->steps[retstep].returningexpr.jumpdone = state->steps_len; /* Update ExprState flags */ if (rexpr->retold) @@ -2732,10 +2732,10 @@ ExecInitFunc(ExprEvalStep *scratch, Expr *node, List *args, Oid funcid, FUNC_MAX_ARGS))); /* Allocate function lookup data and parameter workspace for this call */ - scratch->d.func.finfo = palloc0(sizeof(FmgrInfo)); - scratch->d.func.fcinfo_data = palloc0(SizeForFunctionCallInfo(nargs)); - flinfo = scratch->d.func.finfo; - fcinfo = scratch->d.func.fcinfo_data; + scratch->func.finfo = palloc0(sizeof(FmgrInfo)); + scratch->func.fcinfo_data = palloc0(SizeForFunctionCallInfo(nargs)); + flinfo = scratch->func.finfo; + fcinfo = scratch->func.fcinfo_data; /* Set up the primary fmgr lookup information */ fmgr_info(funcid, flinfo); @@ -2746,8 +2746,8 @@ ExecInitFunc(ExprEvalStep *scratch, Expr *node, List *args, Oid funcid, nargs, inputcollid, NULL, NULL); /* Keep extra copies of this info to save an indirection at runtime */ - scratch->d.func.fn_addr = flinfo->fn_addr; - scratch->d.func.nargs = nargs; + scratch->func.fn_addr = flinfo->fn_addr; + scratch->func.nargs = nargs; /* We only support non-set functions here */ if (flinfo->fn_retset) @@ -2853,9 +2853,9 @@ ExecInitSubPlanExpr(SubPlan *subplan, &state->resvalue, &state->resnull); scratch.opcode = EEOP_PARAM_SET; - scratch.d.param.paramid = paramid; + scratch.param.paramid = paramid; /* paramtype's not actually used, but we might as well fill it */ - scratch.d.param.paramtype = exprType((Node *) arg); + scratch.param.paramtype = exprType((Node *) arg); ExprEvalPushStep(state, &scratch); } @@ -2868,7 +2868,7 @@ ExecInitSubPlanExpr(SubPlan *subplan, scratch.opcode = EEOP_SUBPLAN; scratch.resvalue = resv; scratch.resnull = resnull; - scratch.d.subplan.sstate = sstate; + scratch.subplan.sstate = sstate; ExprEvalPushStep(state, &scratch); } @@ -2909,50 +2909,50 @@ ExecPushExprSetupSteps(ExprState *state, ExprSetupInfo *info) if (info->last_inner > 0) { scratch.opcode = EEOP_INNER_FETCHSOME; - scratch.d.fetch.last_var = info->last_inner; - scratch.d.fetch.fixed = false; - scratch.d.fetch.kind = NULL; - scratch.d.fetch.known_desc = NULL; + scratch.fetch.last_var = info->last_inner; + scratch.fetch.fixed = false; + scratch.fetch.kind = NULL; + scratch.fetch.known_desc = NULL; if (ExecComputeSlotInfo(state, &scratch)) ExprEvalPushStep(state, &scratch); } if (info->last_outer > 0) { scratch.opcode = EEOP_OUTER_FETCHSOME; - scratch.d.fetch.last_var = info->last_outer; - scratch.d.fetch.fixed = false; - scratch.d.fetch.kind = NULL; - scratch.d.fetch.known_desc = NULL; + scratch.fetch.last_var = info->last_outer; + scratch.fetch.fixed = false; + scratch.fetch.kind = NULL; + scratch.fetch.known_desc = NULL; if (ExecComputeSlotInfo(state, &scratch)) ExprEvalPushStep(state, &scratch); } if (info->last_scan > 0) { scratch.opcode = EEOP_SCAN_FETCHSOME; - scratch.d.fetch.last_var = info->last_scan; - scratch.d.fetch.fixed = false; - scratch.d.fetch.kind = NULL; - scratch.d.fetch.known_desc = NULL; + scratch.fetch.last_var = info->last_scan; + scratch.fetch.fixed = false; + scratch.fetch.kind = NULL; + scratch.fetch.known_desc = NULL; if (ExecComputeSlotInfo(state, &scratch)) ExprEvalPushStep(state, &scratch); } if (info->last_old > 0) { scratch.opcode = EEOP_OLD_FETCHSOME; - scratch.d.fetch.last_var = info->last_old; - scratch.d.fetch.fixed = false; - scratch.d.fetch.kind = NULL; - scratch.d.fetch.known_desc = NULL; + scratch.fetch.last_var = info->last_old; + scratch.fetch.fixed = false; + scratch.fetch.kind = NULL; + scratch.fetch.known_desc = NULL; if (ExecComputeSlotInfo(state, &scratch)) ExprEvalPushStep(state, &scratch); } if (info->last_new > 0) { scratch.opcode = EEOP_NEW_FETCHSOME; - scratch.d.fetch.last_var = info->last_new; - scratch.d.fetch.fixed = false; - scratch.d.fetch.kind = NULL; - scratch.d.fetch.known_desc = NULL; + scratch.fetch.last_var = info->last_new; + scratch.fetch.fixed = false; + scratch.fetch.kind = NULL; + scratch.fetch.known_desc = NULL; if (ExecComputeSlotInfo(state, &scratch)) ExprEvalPushStep(state, &scratch); } @@ -3073,11 +3073,11 @@ ExecComputeSlotInfo(ExprState *state, ExprEvalStep *op) opcode == EEOP_OLD_FETCHSOME || opcode == EEOP_NEW_FETCHSOME); - if (op->d.fetch.known_desc != NULL) + if (op->fetch.known_desc != NULL) { - desc = op->d.fetch.known_desc; - tts_ops = op->d.fetch.kind; - isfixed = op->d.fetch.kind != NULL; + desc = op->fetch.known_desc; + tts_ops = op->fetch.kind; + isfixed = op->fetch.kind != NULL; } else if (!parent) { @@ -3138,19 +3138,19 @@ ExecComputeSlotInfo(ExprState *state, ExprEvalStep *op) if (isfixed && desc != NULL && tts_ops != NULL) { - op->d.fetch.fixed = true; - op->d.fetch.kind = tts_ops; - op->d.fetch.known_desc = desc; + op->fetch.fixed = true; + op->fetch.kind = tts_ops; + op->fetch.known_desc = desc; } else { - op->d.fetch.fixed = false; - op->d.fetch.kind = NULL; - op->d.fetch.known_desc = NULL; + op->fetch.fixed = false; + op->fetch.kind = NULL; + op->fetch.known_desc = NULL; } /* if the slot is known to always virtual we never need to deform */ - if (op->d.fetch.fixed && op->d.fetch.kind == &TTSOpsVirtual) + if (op->fetch.fixed && op->fetch.kind == &TTSOpsVirtual) return false; return true; @@ -3167,11 +3167,11 @@ ExecInitWholeRowVar(ExprEvalStep *scratch, Var *variable, ExprState *state) /* fill in all but the target */ scratch->opcode = EEOP_WHOLEROW; - scratch->d.wholerow.var = variable; - scratch->d.wholerow.first = true; - scratch->d.wholerow.slow = false; - scratch->d.wholerow.tupdesc = NULL; /* filled at runtime */ - scratch->d.wholerow.junkFilter = NULL; + scratch->wholerow.var = variable; + scratch->wholerow.first = true; + scratch->wholerow.slow = false; + scratch->wholerow.tupdesc = NULL; /* filled at runtime */ + scratch->wholerow.junkFilter = NULL; /* update ExprState flags if Var refers to OLD/NEW */ if (variable->varreturningtype == VAR_RETURNING_OLD) @@ -3227,7 +3227,7 @@ ExecInitWholeRowVar(ExprEvalStep *scratch, Var *variable, ExprState *state) /* If so, build the junkfilter now */ if (junk_filter_needed) { - scratch->d.wholerow.junkFilter = + scratch->wholerow.junkFilter = ExecInitJunkFilter(subplan->plan->targetlist, ExecInitExtraTupleSlot(parent->state, NULL, &TTSOpsVirtual)); @@ -3314,7 +3314,7 @@ ExecInitSubscriptingRef(ExprEvalStep *scratch, SubscriptingRef *sbsref, if (!isAssignment && sbsroutines->fetch_strict) { scratch->opcode = EEOP_JUMP_IF_NULL; - scratch->d.jump.jumpdone = -1; /* adjust later */ + scratch->jump.jumpdone = -1; /* adjust later */ ExprEvalPushStep(state, scratch); adjust_jumps = lappend_int(adjust_jumps, state->steps_len - 1); @@ -3370,9 +3370,9 @@ ExecInitSubscriptingRef(ExprEvalStep *scratch, SubscriptingRef *sbsref, if (methods.sbs_check_subscripts) { scratch->opcode = EEOP_SBSREF_SUBSCRIPTS; - scratch->d.sbsref_subscript.subscriptfunc = methods.sbs_check_subscripts; - scratch->d.sbsref_subscript.state = sbsrefstate; - scratch->d.sbsref_subscript.jumpdone = -1; /* adjust later */ + scratch->sbsref_subscript.subscriptfunc = methods.sbs_check_subscripts; + scratch->sbsref_subscript.state = sbsrefstate; + scratch->sbsref_subscript.jumpdone = -1; /* adjust later */ ExprEvalPushStep(state, scratch); adjust_jumps = lappend_int(adjust_jumps, state->steps_len - 1); @@ -3412,8 +3412,8 @@ ExecInitSubscriptingRef(ExprEvalStep *scratch, SubscriptingRef *sbsref, errmsg("type %s does not support subscripted assignment", format_type_be(sbsref->refcontainertype)))); scratch->opcode = EEOP_SBSREF_OLD; - scratch->d.sbsref.subscriptfunc = methods.sbs_fetch_old; - scratch->d.sbsref.state = sbsrefstate; + scratch->sbsref.subscriptfunc = methods.sbs_fetch_old; + scratch->sbsref.state = sbsrefstate; ExprEvalPushStep(state, scratch); } @@ -3432,16 +3432,16 @@ ExecInitSubscriptingRef(ExprEvalStep *scratch, SubscriptingRef *sbsref, /* and perform the assignment */ scratch->opcode = EEOP_SBSREF_ASSIGN; - scratch->d.sbsref.subscriptfunc = methods.sbs_assign; - scratch->d.sbsref.state = sbsrefstate; + scratch->sbsref.subscriptfunc = methods.sbs_assign; + scratch->sbsref.state = sbsrefstate; ExprEvalPushStep(state, scratch); } else { /* array fetch is much simpler */ scratch->opcode = EEOP_SBSREF_FETCH; - scratch->d.sbsref.subscriptfunc = methods.sbs_fetch; - scratch->d.sbsref.state = sbsrefstate; + scratch->sbsref.subscriptfunc = methods.sbs_fetch; + scratch->sbsref.state = sbsrefstate; ExprEvalPushStep(state, scratch); } @@ -3452,14 +3452,14 @@ ExecInitSubscriptingRef(ExprEvalStep *scratch, SubscriptingRef *sbsref, if (as->opcode == EEOP_SBSREF_SUBSCRIPTS) { - Assert(as->d.sbsref_subscript.jumpdone == -1); - as->d.sbsref_subscript.jumpdone = state->steps_len; + Assert(as->sbsref_subscript.jumpdone == -1); + as->sbsref_subscript.jumpdone = state->steps_len; } else { Assert(as->opcode == EEOP_JUMP_IF_NULL); - Assert(as->d.jump.jumpdone == -1); - as->d.jump.jumpdone = state->steps_len; + Assert(as->jump.jumpdone == -1); + as->jump.jumpdone = state->steps_len; } } } @@ -3527,11 +3527,11 @@ ExecInitCoerceToDomain(ExprEvalStep *scratch, CoerceToDomain *ctest, bool *domainnull = NULL; ListCell *l; - scratch->d.domaincheck.resulttype = ctest->resulttype; + scratch->domaincheck.resulttype = ctest->resulttype; /* we'll allocate workspace only if needed */ - scratch->d.domaincheck.checkvalue = NULL; - scratch->d.domaincheck.checknull = NULL; - scratch->d.domaincheck.escontext = state->escontext; + scratch->domaincheck.checkvalue = NULL; + scratch->domaincheck.checknull = NULL; + scratch->domaincheck.escontext = state->escontext; /* * Evaluate argument - it's fine to directly store it into resv/resnull, @@ -3575,7 +3575,7 @@ ExecInitCoerceToDomain(ExprEvalStep *scratch, CoerceToDomain *ctest, Datum *save_innermost_domainval; bool *save_innermost_domainnull; - scratch->d.domaincheck.constraintname = con->name; + scratch->domaincheck.constraintname = con->name; switch (con->constrainttype) { @@ -3585,11 +3585,11 @@ ExecInitCoerceToDomain(ExprEvalStep *scratch, CoerceToDomain *ctest, break; case DOM_CONSTRAINT_CHECK: /* Allocate workspace for CHECK output if we didn't yet */ - if (scratch->d.domaincheck.checkvalue == NULL) + if (scratch->domaincheck.checkvalue == NULL) { - scratch->d.domaincheck.checkvalue = + scratch->domaincheck.checkvalue = (Datum *) palloc(sizeof(Datum)); - scratch->d.domaincheck.checknull = + scratch->domaincheck.checknull = (bool *) palloc(sizeof(bool)); } @@ -3615,8 +3615,8 @@ ExecInitCoerceToDomain(ExprEvalStep *scratch, CoerceToDomain *ctest, scratch2.opcode = EEOP_MAKE_READONLY; scratch2.resvalue = domainval; scratch2.resnull = domainnull; - scratch2.d.make_readonly.value = resv; - scratch2.d.make_readonly.isnull = resnull; + scratch2.make_readonly.value = resv; + scratch2.make_readonly.isnull = resnull; ExprEvalPushStep(state, &scratch2); } else @@ -3640,8 +3640,8 @@ ExecInitCoerceToDomain(ExprEvalStep *scratch, CoerceToDomain *ctest, /* evaluate check expression value */ ExecInitExprRec(con->check_expr, state, - scratch->d.domaincheck.checkvalue, - scratch->d.domaincheck.checknull); + scratch->domaincheck.checkvalue, + scratch->domaincheck.checknull); state->innermost_domainval = save_innermost_domainval; state->innermost_domainnull = save_innermost_domainnull; @@ -3736,7 +3736,7 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, &state->resvalue, &state->resnull); /* and jump out if false */ scratch.opcode = EEOP_JUMP_IF_NOT_TRUE; - scratch.d.jump.jumpdone = -1; /* adjust later */ + scratch.jump.jumpdone = -1; /* adjust later */ ExprEvalPushStep(state, &scratch); adjust_bailout = lappend_int(adjust_bailout, state->steps_len - 1); @@ -3797,8 +3797,8 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, else scratch.opcode = EEOP_AGG_DESERIALIZE; - scratch.d.agg_deserialize.fcinfo_data = ds_fcinfo; - scratch.d.agg_deserialize.jumpnull = -1; /* adjust later */ + scratch.agg_deserialize.fcinfo_data = ds_fcinfo; + scratch.agg_deserialize.jumpnull = -1; /* adjust later */ scratch.resvalue = &trans_fcinfo->args[argno + 1].value; scratch.resnull = &trans_fcinfo->args[argno + 1].isnull; @@ -3904,10 +3904,10 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, scratch.opcode = EEOP_AGG_STRICT_INPUT_CHECK_ARGS_1; else scratch.opcode = EEOP_AGG_STRICT_INPUT_CHECK_ARGS; - scratch.d.agg_strict_input_check.nulls = strictnulls; - scratch.d.agg_strict_input_check.args = strictargs; - scratch.d.agg_strict_input_check.jumpnull = -1; /* adjust later */ - scratch.d.agg_strict_input_check.nargs = pertrans->numTransInputs; + scratch.agg_strict_input_check.nulls = strictnulls; + scratch.agg_strict_input_check.args = strictargs; + scratch.agg_strict_input_check.jumpnull = -1; /* adjust later */ + scratch.agg_strict_input_check.nargs = pertrans->numTransInputs; ExprEvalPushStep(state, &scratch); adjust_bailout = lappend_int(adjust_bailout, state->steps_len - 1); @@ -3921,8 +3921,8 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, else scratch.opcode = EEOP_AGG_PRESORTED_DISTINCT_SINGLE; - scratch.d.agg_presorted_distinctcheck.pertrans = pertrans; - scratch.d.agg_presorted_distinctcheck.jumpdistinct = -1; /* adjust later */ + scratch.agg_presorted_distinctcheck.pertrans = pertrans; + scratch.agg_presorted_distinctcheck.jumpdistinct = -1; /* adjust later */ ExprEvalPushStep(state, &scratch); adjust_bailout = lappend_int(adjust_bailout, state->steps_len - 1); @@ -3974,26 +3974,26 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, if (as->opcode == EEOP_JUMP_IF_NOT_TRUE) { - Assert(as->d.jump.jumpdone == -1); - as->d.jump.jumpdone = state->steps_len; + Assert(as->jump.jumpdone == -1); + as->jump.jumpdone = state->steps_len; } else if (as->opcode == EEOP_AGG_STRICT_INPUT_CHECK_ARGS || as->opcode == EEOP_AGG_STRICT_INPUT_CHECK_ARGS_1 || as->opcode == EEOP_AGG_STRICT_INPUT_CHECK_NULLS) { - Assert(as->d.agg_strict_input_check.jumpnull == -1); - as->d.agg_strict_input_check.jumpnull = state->steps_len; + Assert(as->agg_strict_input_check.jumpnull == -1); + as->agg_strict_input_check.jumpnull = state->steps_len; } else if (as->opcode == EEOP_AGG_STRICT_DESERIALIZE) { - Assert(as->d.agg_deserialize.jumpnull == -1); - as->d.agg_deserialize.jumpnull = state->steps_len; + Assert(as->agg_deserialize.jumpnull == -1); + as->agg_deserialize.jumpnull = state->steps_len; } else if (as->opcode == EEOP_AGG_PRESORTED_DISTINCT_SINGLE || as->opcode == EEOP_AGG_PRESORTED_DISTINCT_MULTI) { - Assert(as->d.agg_presorted_distinctcheck.jumpdistinct == -1); - as->d.agg_presorted_distinctcheck.jumpdistinct = state->steps_len; + Assert(as->agg_presorted_distinctcheck.jumpdistinct == -1); + as->agg_presorted_distinctcheck.jumpdistinct = state->steps_len; } else Assert(false); @@ -4034,9 +4034,9 @@ ExecBuildAggTransCall(ExprState *state, AggState *aggstate, if (nullcheck) { scratch->opcode = EEOP_AGG_PLAIN_PERGROUP_NULLCHECK; - scratch->d.agg_plain_pergroup_nullcheck.setoff = setoff; + scratch->agg_plain_pergroup_nullcheck.setoff = setoff; /* adjust later */ - scratch->d.agg_plain_pergroup_nullcheck.jumpnull = -1; + scratch->agg_plain_pergroup_nullcheck.jumpnull = -1; ExprEvalPushStep(state, scratch); adjust_jumpnull = state->steps_len - 1; } @@ -4103,11 +4103,11 @@ ExecBuildAggTransCall(ExprState *state, AggState *aggstate, else scratch->opcode = EEOP_AGG_ORDERED_TRANS_TUPLE; - scratch->d.agg_trans.pertrans = pertrans; - scratch->d.agg_trans.setno = setno; - scratch->d.agg_trans.setoff = setoff; - scratch->d.agg_trans.transno = transno; - scratch->d.agg_trans.aggcontext = aggcontext; + scratch->agg_trans.pertrans = pertrans; + scratch->agg_trans.setno = setno; + scratch->agg_trans.setoff = setoff; + scratch->agg_trans.transno = transno; + scratch->agg_trans.aggcontext = aggcontext; ExprEvalPushStep(state, scratch); /* fix up jumpnull */ @@ -4116,8 +4116,8 @@ ExecBuildAggTransCall(ExprState *state, AggState *aggstate, ExprEvalStep *as = &state->steps[adjust_jumpnull]; Assert(as->opcode == EEOP_AGG_PLAIN_PERGROUP_NULLCHECK); - Assert(as->d.agg_plain_pergroup_nullcheck.jumpnull == -1); - as->d.agg_plain_pergroup_nullcheck.jumpnull = state->steps_len; + Assert(as->agg_plain_pergroup_nullcheck.jumpnull == -1); + as->agg_plain_pergroup_nullcheck.jumpnull = state->steps_len; } } @@ -4166,10 +4166,10 @@ ExecBuildHash32FromAttrs(TupleDesc desc, const TupleTableSlotOps *ops, last_attnum = Max(last_attnum, keyColIdx[i]); scratch.opcode = EEOP_INNER_FETCHSOME; - scratch.d.fetch.last_var = last_attnum; - scratch.d.fetch.fixed = false; - scratch.d.fetch.kind = ops; - scratch.d.fetch.known_desc = desc; + scratch.fetch.last_var = last_attnum; + scratch.fetch.fixed = false; + scratch.fetch.kind = ops; + scratch.fetch.known_desc = desc; if (ExecComputeSlotInfo(state, &scratch)) ExprEvalPushStep(state, &scratch); @@ -4190,7 +4190,7 @@ ExecBuildHash32FromAttrs(TupleDesc desc, const TupleTableSlotOps *ops, * columns to hash, store it in the ExprState's result field. */ scratch.opcode = EEOP_HASHDATUM_SET_INITVAL; - scratch.d.hashdatum_initvalue.init_value = UInt32GetDatum(init_value); + scratch.hashdatum_initvalue.init_value = UInt32GetDatum(init_value); scratch.resvalue = numCols > 0 ? &iresult->value : &state->resvalue; scratch.resnull = numCols > 0 ? &iresult->isnull : &state->resnull; @@ -4223,9 +4223,9 @@ ExecBuildHash32FromAttrs(TupleDesc desc, const TupleTableSlotOps *ops, scratch.opcode = EEOP_INNER_VAR; scratch.resvalue = &fcinfo->args[0].value; scratch.resnull = &fcinfo->args[0].isnull; - scratch.d.var.attnum = attnum; - scratch.d.var.vartype = TupleDescAttr(desc, attnum)->atttypid; - scratch.d.var.varreturningtype = VAR_RETURNING_DEFAULT; + scratch.var.attnum = attnum; + scratch.var.vartype = TupleDescAttr(desc, attnum)->atttypid; + scratch.var.varreturningtype = VAR_RETURNING_DEFAULT; ExprEvalPushStep(state, &scratch); @@ -4254,12 +4254,12 @@ ExecBuildHash32FromAttrs(TupleDesc desc, const TupleTableSlotOps *ops, * NEXT32 opcodes need to look at the intermediate result. We might * as well just set this for all ops. FIRSTs won't look at it. */ - scratch.d.hashdatum.iresult = iresult; + scratch.hashdatum.iresult = iresult; - scratch.d.hashdatum.finfo = finfo; - scratch.d.hashdatum.fcinfo_data = fcinfo; - scratch.d.hashdatum.fn_addr = finfo->fn_addr; - scratch.d.hashdatum.jumpdone = -1; + scratch.hashdatum.finfo = finfo; + scratch.hashdatum.fcinfo_data = fcinfo; + scratch.hashdatum.fn_addr = finfo->fn_addr; + scratch.hashdatum.jumpdone = -1; ExprEvalPushStep(state, &scratch); @@ -4345,7 +4345,7 @@ ExecBuildHash32Expr(TupleDesc desc, const TupleTableSlotOps *ops, * to hash, store it in the ExprState's result field. */ scratch.opcode = EEOP_HASHDATUM_SET_INITVAL; - scratch.d.hashdatum_initvalue.init_value = UInt32GetDatum(init_value); + scratch.hashdatum_initvalue.init_value = UInt32GetDatum(init_value); scratch.resvalue = num_exprs > 0 ? &iresult->value : &state->resvalue; scratch.resnull = num_exprs > 0 ? &iresult->isnull : &state->resnull; @@ -4404,17 +4404,17 @@ ExecBuildHash32Expr(TupleDesc desc, const TupleTableSlotOps *ops, * NEXT32 opcodes need to look at the intermediate result. We might * as well just set this for all ops. FIRSTs won't look at it. */ - scratch.d.hashdatum.iresult = iresult; + scratch.hashdatum.iresult = iresult; /* Initialize function call parameter structure too */ InitFunctionCallInfoData(*fcinfo, finfo, 1, inputcollid, NULL, NULL); - scratch.d.hashdatum.finfo = finfo; - scratch.d.hashdatum.fcinfo_data = fcinfo; - scratch.d.hashdatum.fn_addr = finfo->fn_addr; + scratch.hashdatum.finfo = finfo; + scratch.hashdatum.fcinfo_data = fcinfo; + scratch.hashdatum.fn_addr = finfo->fn_addr; scratch.opcode = opstrict[i] && !keep_nulls ? strict_opcode : opcode; - scratch.d.hashdatum.jumpdone = -1; + scratch.hashdatum.jumpdone = -1; ExprEvalPushStep(state, &scratch); adjust_jumps = lappend_int(adjust_jumps, state->steps_len - 1); @@ -4436,8 +4436,8 @@ ExecBuildHash32Expr(TupleDesc desc, const TupleTableSlotOps *ops, as->opcode == EEOP_HASHDATUM_FIRST_STRICT || as->opcode == EEOP_HASHDATUM_NEXT32 || as->opcode == EEOP_HASHDATUM_NEXT32_STRICT); - Assert(as->d.hashdatum.jumpdone == -1); - as->d.hashdatum.jumpdone = state->steps_len; + Assert(as->hashdatum.jumpdone == -1); + as->hashdatum.jumpdone = state->steps_len; } scratch.resvalue = NULL; @@ -4502,18 +4502,18 @@ ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc, /* push deform steps */ scratch.opcode = EEOP_INNER_FETCHSOME; - scratch.d.fetch.last_var = maxatt; - scratch.d.fetch.fixed = false; - scratch.d.fetch.known_desc = ldesc; - scratch.d.fetch.kind = lops; + scratch.fetch.last_var = maxatt; + scratch.fetch.fixed = false; + scratch.fetch.known_desc = ldesc; + scratch.fetch.kind = lops; if (ExecComputeSlotInfo(state, &scratch)) ExprEvalPushStep(state, &scratch); scratch.opcode = EEOP_OUTER_FETCHSOME; - scratch.d.fetch.last_var = maxatt; - scratch.d.fetch.fixed = false; - scratch.d.fetch.known_desc = rdesc; - scratch.d.fetch.kind = rops; + scratch.fetch.last_var = maxatt; + scratch.fetch.fixed = false; + scratch.fetch.known_desc = rdesc; + scratch.fetch.kind = rops; if (ExecComputeSlotInfo(state, &scratch)) ExprEvalPushStep(state, &scratch); @@ -4549,35 +4549,35 @@ ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc, /* left arg */ scratch.opcode = EEOP_INNER_VAR; - scratch.d.var.attnum = attno - 1; - scratch.d.var.vartype = latt->atttypid; - scratch.d.var.varreturningtype = VAR_RETURNING_DEFAULT; + scratch.var.attnum = attno - 1; + scratch.var.vartype = latt->atttypid; + scratch.var.varreturningtype = VAR_RETURNING_DEFAULT; scratch.resvalue = &fcinfo->args[0].value; scratch.resnull = &fcinfo->args[0].isnull; ExprEvalPushStep(state, &scratch); /* right arg */ scratch.opcode = EEOP_OUTER_VAR; - scratch.d.var.attnum = attno - 1; - scratch.d.var.vartype = ratt->atttypid; - scratch.d.var.varreturningtype = VAR_RETURNING_DEFAULT; + scratch.var.attnum = attno - 1; + scratch.var.vartype = ratt->atttypid; + scratch.var.varreturningtype = VAR_RETURNING_DEFAULT; scratch.resvalue = &fcinfo->args[1].value; scratch.resnull = &fcinfo->args[1].isnull; ExprEvalPushStep(state, &scratch); /* evaluate distinctness */ scratch.opcode = EEOP_NOT_DISTINCT; - scratch.d.func.finfo = finfo; - scratch.d.func.fcinfo_data = fcinfo; - scratch.d.func.fn_addr = finfo->fn_addr; - scratch.d.func.nargs = 2; + scratch.func.finfo = finfo; + scratch.func.fcinfo_data = fcinfo; + scratch.func.fn_addr = finfo->fn_addr; + scratch.func.nargs = 2; scratch.resvalue = &state->resvalue; scratch.resnull = &state->resnull; ExprEvalPushStep(state, &scratch); /* then emit EEOP_QUAL to detect if result is false (or null) */ scratch.opcode = EEOP_QUAL; - scratch.d.qualexpr.jumpdone = -1; + scratch.qualexpr.jumpdone = -1; scratch.resvalue = &state->resvalue; scratch.resnull = &state->resnull; ExprEvalPushStep(state, &scratch); @@ -4591,8 +4591,8 @@ ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc, ExprEvalStep *as = &state->steps[lfirst_int(lc)]; Assert(as->opcode == EEOP_QUAL); - Assert(as->d.qualexpr.jumpdone == -1); - as->d.qualexpr.jumpdone = state->steps_len; + Assert(as->qualexpr.jumpdone == -1); + as->qualexpr.jumpdone = state->steps_len; } scratch.resvalue = NULL; @@ -4644,18 +4644,18 @@ ExecBuildParamSetEqual(TupleDesc desc, /* push deform steps */ scratch.opcode = EEOP_INNER_FETCHSOME; - scratch.d.fetch.last_var = maxatt; - scratch.d.fetch.fixed = false; - scratch.d.fetch.known_desc = desc; - scratch.d.fetch.kind = lops; + scratch.fetch.last_var = maxatt; + scratch.fetch.fixed = false; + scratch.fetch.known_desc = desc; + scratch.fetch.kind = lops; if (ExecComputeSlotInfo(state, &scratch)) ExprEvalPushStep(state, &scratch); scratch.opcode = EEOP_OUTER_FETCHSOME; - scratch.d.fetch.last_var = maxatt; - scratch.d.fetch.fixed = false; - scratch.d.fetch.known_desc = desc; - scratch.d.fetch.kind = rops; + scratch.fetch.last_var = maxatt; + scratch.fetch.fixed = false; + scratch.fetch.known_desc = desc; + scratch.fetch.kind = rops; if (ExecComputeSlotInfo(state, &scratch)) ExprEvalPushStep(state, &scratch); @@ -4685,35 +4685,35 @@ ExecBuildParamSetEqual(TupleDesc desc, /* left arg */ scratch.opcode = EEOP_INNER_VAR; - scratch.d.var.attnum = attno; - scratch.d.var.vartype = att->atttypid; - scratch.d.var.varreturningtype = VAR_RETURNING_DEFAULT; + scratch.var.attnum = attno; + scratch.var.vartype = att->atttypid; + scratch.var.varreturningtype = VAR_RETURNING_DEFAULT; scratch.resvalue = &fcinfo->args[0].value; scratch.resnull = &fcinfo->args[0].isnull; ExprEvalPushStep(state, &scratch); /* right arg */ scratch.opcode = EEOP_OUTER_VAR; - scratch.d.var.attnum = attno; - scratch.d.var.vartype = att->atttypid; - scratch.d.var.varreturningtype = VAR_RETURNING_DEFAULT; + scratch.var.attnum = attno; + scratch.var.vartype = att->atttypid; + scratch.var.varreturningtype = VAR_RETURNING_DEFAULT; scratch.resvalue = &fcinfo->args[1].value; scratch.resnull = &fcinfo->args[1].isnull; ExprEvalPushStep(state, &scratch); /* evaluate distinctness */ scratch.opcode = EEOP_NOT_DISTINCT; - scratch.d.func.finfo = finfo; - scratch.d.func.fcinfo_data = fcinfo; - scratch.d.func.fn_addr = finfo->fn_addr; - scratch.d.func.nargs = 2; + scratch.func.finfo = finfo; + scratch.func.fcinfo_data = fcinfo; + scratch.func.fn_addr = finfo->fn_addr; + scratch.func.nargs = 2; scratch.resvalue = &state->resvalue; scratch.resnull = &state->resnull; ExprEvalPushStep(state, &scratch); /* then emit EEOP_QUAL to detect if result is false (or null) */ scratch.opcode = EEOP_QUAL; - scratch.d.qualexpr.jumpdone = -1; + scratch.qualexpr.jumpdone = -1; scratch.resvalue = &state->resvalue; scratch.resnull = &state->resnull; ExprEvalPushStep(state, &scratch); @@ -4727,8 +4727,8 @@ ExecBuildParamSetEqual(TupleDesc desc, ExprEvalStep *as = &state->steps[lfirst_int(lc)]; Assert(as->opcode == EEOP_QUAL); - Assert(as->d.qualexpr.jumpdone == -1); - as->d.qualexpr.jumpdone = state->steps_len; + Assert(as->qualexpr.jumpdone == -1); + as->qualexpr.jumpdone = state->steps_len; } scratch.resvalue = NULL; @@ -4775,7 +4775,7 @@ ExecInitJsonExpr(JsonExpr *jsexpr, ExprState *state, jumps_return_null = lappend_int(jumps_return_null, state->steps_len); scratch->opcode = EEOP_JUMP_IF_NULL; scratch->resnull = &jsestate->formatted_expr.isnull; - scratch->d.jump.jumpdone = -1; /* set below */ + scratch->jump.jumpdone = -1; /* set below */ ExprEvalPushStep(state, scratch); /* @@ -4790,7 +4790,7 @@ ExecInitJsonExpr(JsonExpr *jsexpr, ExprState *state, jumps_return_null = lappend_int(jumps_return_null, state->steps_len); scratch->opcode = EEOP_JUMP_IF_NULL; scratch->resnull = &jsestate->pathspec.isnull; - scratch->d.jump.jumpdone = -1; /* set below */ + scratch->jump.jumpdone = -1; /* set below */ ExprEvalPushStep(state, scratch); /* Steps to compute PASSING args. */ @@ -4816,7 +4816,7 @@ ExecInitJsonExpr(JsonExpr *jsexpr, ExprState *state, scratch->opcode = EEOP_JSONEXPR_PATH; scratch->resvalue = resv; scratch->resnull = resnull; - scratch->d.jsonexpr.jsestate = jsestate; + scratch->jsonexpr.jsestate = jsestate; ExprEvalPushStep(state, scratch); /* @@ -4828,13 +4828,13 @@ ExecInitJsonExpr(JsonExpr *jsexpr, ExprState *state, { ExprEvalStep *as = &state->steps[lfirst_int(lc)]; - as->d.jump.jumpdone = state->steps_len; + as->jump.jumpdone = state->steps_len; } scratch->opcode = EEOP_CONST; scratch->resvalue = resv; scratch->resnull = resnull; - scratch->d.constval.value = (Datum) 0; - scratch->d.constval.isnull = true; + scratch->constval.value = (Datum) 0; + scratch->constval.isnull = true; ExprEvalPushStep(state, scratch); escontext = jsexpr->on_error->btype != JSON_BEHAVIOR_ERROR ? @@ -4901,7 +4901,7 @@ ExecInitJsonExpr(JsonExpr *jsexpr, ExprState *state, if (jsestate->jump_eval_coercion >= 0 && escontext != NULL) { scratch->opcode = EEOP_JSONEXPR_COERCION_FINISH; - scratch->d.jsonexpr.jsestate = jsestate; + scratch->jsonexpr.jsestate = jsestate; ExprEvalPushStep(state, scratch); } @@ -4933,7 +4933,7 @@ ExecInitJsonExpr(JsonExpr *jsexpr, ExprState *state, scratch->opcode = EEOP_JUMP_IF_NOT_TRUE; scratch->resvalue = &jsestate->error.value; scratch->resnull = &jsestate->error.isnull; - scratch->d.jump.jumpdone = -1; /* set below */ + scratch->jump.jumpdone = -1; /* set below */ ExprEvalPushStep(state, scratch); /* @@ -4963,14 +4963,14 @@ ExecInitJsonExpr(JsonExpr *jsexpr, ExprState *state, scratch->opcode = EEOP_JSONEXPR_COERCION_FINISH; scratch->resvalue = resv; scratch->resnull = resnull; - scratch->d.jsonexpr.jsestate = jsestate; + scratch->jsonexpr.jsestate = jsestate; ExprEvalPushStep(state, scratch); } /* JUMP to end to skip the ON EMPTY steps added below. */ jumps_to_end = lappend_int(jumps_to_end, state->steps_len); scratch->opcode = EEOP_JUMP; - scratch->d.jump.jumpdone = -1; + scratch->jump.jumpdone = -1; ExprEvalPushStep(state, scratch); } @@ -4996,7 +4996,7 @@ ExecInitJsonExpr(JsonExpr *jsexpr, ExprState *state, scratch->opcode = EEOP_JUMP_IF_NOT_TRUE; scratch->resvalue = &jsestate->empty.value; scratch->resnull = &jsestate->empty.isnull; - scratch->d.jump.jumpdone = -1; /* set below */ + scratch->jump.jumpdone = -1; /* set below */ ExprEvalPushStep(state, scratch); /* @@ -5027,7 +5027,7 @@ ExecInitJsonExpr(JsonExpr *jsexpr, ExprState *state, scratch->opcode = EEOP_JSONEXPR_COERCION_FINISH; scratch->resvalue = resv; scratch->resnull = resnull; - scratch->d.jsonexpr.jsestate = jsestate; + scratch->jsonexpr.jsestate = jsestate; ExprEvalPushStep(state, scratch); } } @@ -5036,7 +5036,7 @@ ExecInitJsonExpr(JsonExpr *jsexpr, ExprState *state, { ExprEvalStep *as = &state->steps[lfirst_int(lc)]; - as->d.jump.jumpdone = state->steps_len; + as->jump.jumpdone = state->steps_len; } jsestate->jump_end = state->steps_len; @@ -5058,15 +5058,15 @@ ExecInitJsonCoercion(ExprState *state, JsonReturning *returning, scratch.opcode = EEOP_JSONEXPR_COERCION; scratch.resvalue = resv; scratch.resnull = resnull; - scratch.d.jsonexpr_coercion.targettype = returning->typid; - scratch.d.jsonexpr_coercion.targettypmod = returning->typmod; - scratch.d.jsonexpr_coercion.json_coercion_cache = NULL; - scratch.d.jsonexpr_coercion.escontext = escontext; - scratch.d.jsonexpr_coercion.omit_quotes = omit_quotes; - scratch.d.jsonexpr_coercion.exists_coerce = exists_coerce; - scratch.d.jsonexpr_coercion.exists_cast_to_int = exists_coerce && + scratch.jsonexpr_coercion.targettype = returning->typid; + scratch.jsonexpr_coercion.targettypmod = returning->typmod; + scratch.jsonexpr_coercion.json_coercion_cache = NULL; + scratch.jsonexpr_coercion.escontext = escontext; + scratch.jsonexpr_coercion.omit_quotes = omit_quotes; + scratch.jsonexpr_coercion.exists_coerce = exists_coerce; + scratch.jsonexpr_coercion.exists_cast_to_int = exists_coerce && getBaseType(returning->typid) == INT4OID; - scratch.d.jsonexpr_coercion.exists_check_domain = exists_coerce && + scratch.jsonexpr_coercion.exists_check_domain = exists_coerce && DomainHasConstraints(returning->typid); ExprEvalPushStep(state, &scratch); } diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c index 0e1a74976f7..51f498bd79a 100644 --- a/src/backend/executor/execExprInterp.c +++ b/src/backend/executor/execExprInterp.c @@ -635,7 +635,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) { CheckOpSlotCompatibility(op, innerslot); - slot_getsomeattrs(innerslot, op->d.fetch.last_var); + slot_getsomeattrs(innerslot, op->fetch.last_var); EEO_NEXT(); } @@ -644,7 +644,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) { CheckOpSlotCompatibility(op, outerslot); - slot_getsomeattrs(outerslot, op->d.fetch.last_var); + slot_getsomeattrs(outerslot, op->fetch.last_var); EEO_NEXT(); } @@ -653,7 +653,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) { CheckOpSlotCompatibility(op, scanslot); - slot_getsomeattrs(scanslot, op->d.fetch.last_var); + slot_getsomeattrs(scanslot, op->fetch.last_var); EEO_NEXT(); } @@ -662,7 +662,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) { CheckOpSlotCompatibility(op, oldslot); - slot_getsomeattrs(oldslot, op->d.fetch.last_var); + slot_getsomeattrs(oldslot, op->fetch.last_var); EEO_NEXT(); } @@ -671,14 +671,14 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) { CheckOpSlotCompatibility(op, newslot); - slot_getsomeattrs(newslot, op->d.fetch.last_var); + slot_getsomeattrs(newslot, op->fetch.last_var); EEO_NEXT(); } EEO_CASE(EEOP_INNER_VAR) { - int attnum = op->d.var.attnum; + int attnum = op->var.attnum; /* * Since we already extracted all referenced columns from the @@ -695,7 +695,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_OUTER_VAR) { - int attnum = op->d.var.attnum; + int attnum = op->var.attnum; /* See EEOP_INNER_VAR comments */ @@ -708,7 +708,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_SCAN_VAR) { - int attnum = op->d.var.attnum; + int attnum = op->var.attnum; /* See EEOP_INNER_VAR comments */ @@ -721,7 +721,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_OLD_VAR) { - int attnum = op->d.var.attnum; + int attnum = op->var.attnum; /* See EEOP_INNER_VAR comments */ @@ -734,7 +734,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_NEW_VAR) { - int attnum = op->d.var.attnum; + int attnum = op->var.attnum; /* See EEOP_INNER_VAR comments */ @@ -785,8 +785,8 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_ASSIGN_INNER_VAR) { - int resultnum = op->d.assign_var.resultnum; - int attnum = op->d.assign_var.attnum; + int resultnum = op->assign_var.resultnum; + int attnum = op->assign_var.attnum; /* * We do not need CheckVarSlotCompatibility here; that was taken @@ -802,8 +802,8 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_ASSIGN_OUTER_VAR) { - int resultnum = op->d.assign_var.resultnum; - int attnum = op->d.assign_var.attnum; + int resultnum = op->assign_var.resultnum; + int attnum = op->assign_var.attnum; /* * We do not need CheckVarSlotCompatibility here; that was taken @@ -819,8 +819,8 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_ASSIGN_SCAN_VAR) { - int resultnum = op->d.assign_var.resultnum; - int attnum = op->d.assign_var.attnum; + int resultnum = op->assign_var.resultnum; + int attnum = op->assign_var.attnum; /* * We do not need CheckVarSlotCompatibility here; that was taken @@ -836,8 +836,8 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_ASSIGN_OLD_VAR) { - int resultnum = op->d.assign_var.resultnum; - int attnum = op->d.assign_var.attnum; + int resultnum = op->assign_var.resultnum; + int attnum = op->assign_var.attnum; /* * We do not need CheckVarSlotCompatibility here; that was taken @@ -853,8 +853,8 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_ASSIGN_NEW_VAR) { - int resultnum = op->d.assign_var.resultnum; - int attnum = op->d.assign_var.attnum; + int resultnum = op->assign_var.resultnum; + int attnum = op->assign_var.attnum; /* * We do not need CheckVarSlotCompatibility here; that was taken @@ -870,7 +870,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_ASSIGN_TMP) { - int resultnum = op->d.assign_tmp.resultnum; + int resultnum = op->assign_tmp.resultnum; Assert(resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts); resultslot->tts_values[resultnum] = state->resvalue; @@ -881,7 +881,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_ASSIGN_TMP_MAKE_RO) { - int resultnum = op->d.assign_tmp.resultnum; + int resultnum = op->assign_tmp.resultnum; Assert(resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts); resultslot->tts_isnull[resultnum] = state->resnull; @@ -896,8 +896,8 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_CONST) { - *op->resnull = op->d.constval.isnull; - *op->resvalue = op->d.constval.value; + *op->resnull = op->constval.isnull; + *op->resvalue = op->constval.value; EEO_NEXT(); } @@ -919,11 +919,11 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) */ EEO_CASE(EEOP_FUNCEXPR) { - FunctionCallInfo fcinfo = op->d.func.fcinfo_data; + FunctionCallInfo fcinfo = op->func.fcinfo_data; Datum d; fcinfo->isnull = false; - d = op->d.func.fn_addr(fcinfo); + d = op->func.fn_addr(fcinfo); *op->resvalue = d; *op->resnull = fcinfo->isnull; @@ -933,9 +933,9 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) /* strict function call with more than two arguments */ EEO_CASE(EEOP_FUNCEXPR_STRICT) { - FunctionCallInfo fcinfo = op->d.func.fcinfo_data; + FunctionCallInfo fcinfo = op->func.fcinfo_data; NullableDatum *args = fcinfo->args; - int nargs = op->d.func.nargs; + int nargs = op->func.nargs; Datum d; Assert(nargs > 2); @@ -950,7 +950,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) } } fcinfo->isnull = false; - d = op->d.func.fn_addr(fcinfo); + d = op->func.fn_addr(fcinfo); *op->resvalue = d; *op->resnull = fcinfo->isnull; @@ -961,10 +961,10 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) /* strict function call with one argument */ EEO_CASE(EEOP_FUNCEXPR_STRICT_1) { - FunctionCallInfo fcinfo = op->d.func.fcinfo_data; + FunctionCallInfo fcinfo = op->func.fcinfo_data; NullableDatum *args = fcinfo->args; - Assert(op->d.func.nargs == 1); + Assert(op->func.nargs == 1); /* strict function, so check for NULL args */ if (args[0].isnull) @@ -974,7 +974,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) Datum d; fcinfo->isnull = false; - d = op->d.func.fn_addr(fcinfo); + d = op->func.fn_addr(fcinfo); *op->resvalue = d; *op->resnull = fcinfo->isnull; } @@ -985,10 +985,10 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) /* strict function call with two arguments */ EEO_CASE(EEOP_FUNCEXPR_STRICT_2) { - FunctionCallInfo fcinfo = op->d.func.fcinfo_data; + FunctionCallInfo fcinfo = op->func.fcinfo_data; NullableDatum *args = fcinfo->args; - Assert(op->d.func.nargs == 2); + Assert(op->func.nargs == 2); /* strict function, so check for NULL args */ if (args[0].isnull || args[1].isnull) @@ -998,7 +998,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) Datum d; fcinfo->isnull = false; - d = op->d.func.fn_addr(fcinfo); + d = op->func.fn_addr(fcinfo); *op->resvalue = d; *op->resnull = fcinfo->isnull; } @@ -1034,7 +1034,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) */ EEO_CASE(EEOP_BOOL_AND_STEP_FIRST) { - *op->d.boolexpr.anynull = false; + *op->boolexpr.anynull = false; /* * EEOP_BOOL_AND_STEP_FIRST resets anynull, otherwise it's the @@ -1048,13 +1048,13 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) { if (*op->resnull) { - *op->d.boolexpr.anynull = true; + *op->boolexpr.anynull = true; } else if (!DatumGetBool(*op->resvalue)) { /* result is already set to FALSE, need not change it */ /* bail out early */ - EEO_JUMP(op->d.boolexpr.jumpdone); + EEO_JUMP(op->boolexpr.jumpdone); } EEO_NEXT(); @@ -1076,7 +1076,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) * except more expensive. */ } - else if (*op->d.boolexpr.anynull) + else if (*op->boolexpr.anynull) { *op->resvalue = (Datum) 0; *op->resnull = true; @@ -1101,7 +1101,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) */ EEO_CASE(EEOP_BOOL_OR_STEP_FIRST) { - *op->d.boolexpr.anynull = false; + *op->boolexpr.anynull = false; /* * EEOP_BOOL_OR_STEP_FIRST resets anynull, otherwise it's the same @@ -1115,13 +1115,13 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) { if (*op->resnull) { - *op->d.boolexpr.anynull = true; + *op->boolexpr.anynull = true; } else if (DatumGetBool(*op->resvalue)) { /* result is already set to TRUE, need not change it */ /* bail out early */ - EEO_JUMP(op->d.boolexpr.jumpdone); + EEO_JUMP(op->boolexpr.jumpdone); } EEO_NEXT(); @@ -1143,7 +1143,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) * more expensive. */ } - else if (*op->d.boolexpr.anynull) + else if (*op->boolexpr.anynull) { *op->resvalue = (Datum) 0; *op->resnull = true; @@ -1180,7 +1180,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) /* ... bail out early, returning FALSE */ *op->resnull = false; *op->resvalue = BoolGetDatum(false); - EEO_JUMP(op->d.qualexpr.jumpdone); + EEO_JUMP(op->qualexpr.jumpdone); } /* @@ -1194,14 +1194,14 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_JUMP) { /* Unconditionally jump to target step */ - EEO_JUMP(op->d.jump.jumpdone); + EEO_JUMP(op->jump.jumpdone); } EEO_CASE(EEOP_JUMP_IF_NULL) { /* Transfer control if current result is null */ if (*op->resnull) - EEO_JUMP(op->d.jump.jumpdone); + EEO_JUMP(op->jump.jumpdone); EEO_NEXT(); } @@ -1210,7 +1210,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) { /* Transfer control if current result is non-null */ if (!*op->resnull) - EEO_JUMP(op->d.jump.jumpdone); + EEO_JUMP(op->jump.jumpdone); EEO_NEXT(); } @@ -1219,7 +1219,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) { /* Transfer control if current result is null or false */ if (*op->resnull || !DatumGetBool(*op->resvalue)) - EEO_JUMP(op->d.jump.jumpdone); + EEO_JUMP(op->jump.jumpdone); EEO_NEXT(); } @@ -1326,7 +1326,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_PARAM_CALLBACK) { /* allow an extension module to supply a PARAM_EXTERN value */ - op->d.cparam.paramfunc(state, op, econtext); + op->cparam.paramfunc(state, op, econtext); EEO_NEXT(); } @@ -1339,8 +1339,8 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_CASE_TESTVAL) { - *op->resvalue = *op->d.casetest.value; - *op->resnull = *op->d.casetest.isnull; + *op->resvalue = *op->casetest.value; + *op->resnull = *op->casetest.isnull; EEO_NEXT(); } @@ -1358,10 +1358,10 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) /* * Force a varlena value that might be read multiple times to R/O */ - if (!*op->d.make_readonly.isnull) + if (!*op->make_readonly.isnull) *op->resvalue = - MakeExpandedObjectReadOnlyInternal(*op->d.make_readonly.value); - *op->resnull = *op->d.make_readonly.isnull; + MakeExpandedObjectReadOnlyInternal(*op->make_readonly.value); + *op->resnull = *op->make_readonly.isnull; EEO_NEXT(); } @@ -1388,7 +1388,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) { FunctionCallInfo fcinfo_out; - fcinfo_out = op->d.iocoerce.fcinfo_data_out; + fcinfo_out = op->iocoerce.fcinfo_data_out; fcinfo_out->args[0].value = *op->resvalue; fcinfo_out->args[0].isnull = false; @@ -1400,12 +1400,12 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) } /* call input function (similar to InputFunctionCall) */ - if (!op->d.iocoerce.finfo_in->fn_strict || str != NULL) + if (!op->iocoerce.finfo_in->fn_strict || str != NULL) { FunctionCallInfo fcinfo_in; Datum d; - fcinfo_in = op->d.iocoerce.fcinfo_data_in; + fcinfo_in = op->iocoerce.fcinfo_data_in; fcinfo_in->args[0].value = PointerGetDatum(str); fcinfo_in->args[0].isnull = *op->resnull; /* second and third arguments are already set up */ @@ -1447,7 +1447,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) * that function is strict. Because the handling of nulls is * different, we can't just reuse EEOP_FUNCEXPR. */ - FunctionCallInfo fcinfo = op->d.func.fcinfo_data; + FunctionCallInfo fcinfo = op->func.fcinfo_data; /* check function arguments for NULLness */ if (fcinfo->args[0].isnull && fcinfo->args[1].isnull) @@ -1468,7 +1468,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) Datum eqresult; fcinfo->isnull = false; - eqresult = op->d.func.fn_addr(fcinfo); + eqresult = op->func.fn_addr(fcinfo); /* Must invert result of "="; safe to do even if null */ *op->resvalue = BoolGetDatum(!DatumGetBool(eqresult)); *op->resnull = fcinfo->isnull; @@ -1480,7 +1480,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) /* see EEOP_DISTINCT for comments, this is just inverted */ EEO_CASE(EEOP_NOT_DISTINCT) { - FunctionCallInfo fcinfo = op->d.func.fcinfo_data; + FunctionCallInfo fcinfo = op->func.fcinfo_data; if (fcinfo->args[0].isnull && fcinfo->args[1].isnull) { @@ -1497,7 +1497,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) Datum eqresult; fcinfo->isnull = false; - eqresult = op->d.func.fn_addr(fcinfo); + eqresult = op->func.fn_addr(fcinfo); *op->resvalue = eqresult; *op->resnull = fcinfo->isnull; } @@ -1510,7 +1510,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) /* * The arguments are already evaluated into fcinfo->args. */ - FunctionCallInfo fcinfo = op->d.func.fcinfo_data; + FunctionCallInfo fcinfo = op->func.fcinfo_data; Datum save_arg0 = fcinfo->args[0].value; /* if either argument is NULL they can't be equal */ @@ -1525,12 +1525,12 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) * if we end by returning the first argument, that will be the * original read-write pointer if it was read-write. */ - if (op->d.func.make_ro) + if (op->func.make_ro) fcinfo->args[0].value = MakeExpandedObjectReadOnlyInternal(save_arg0); fcinfo->isnull = false; - result = op->d.func.fn_addr(fcinfo); + result = op->func.fn_addr(fcinfo); /* if the arguments are equal return null */ if (!fcinfo->isnull && DatumGetBool(result)) @@ -1585,12 +1585,12 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) * The next op actually evaluates the expression. If the OLD/NEW * row doesn't exist, skip that and return NULL. */ - if (state->flags & op->d.returningexpr.nullflag) + if (state->flags & op->returningexpr.nullflag) { *op->resvalue = (Datum) 0; *op->resnull = true; - EEO_JUMP(op->d.returningexpr.jumpdone); + EEO_JUMP(op->returningexpr.jumpdone); } EEO_NEXT(); @@ -1622,34 +1622,34 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_ROWCOMPARE_STEP) { - FunctionCallInfo fcinfo = op->d.rowcompare_step.fcinfo_data; + FunctionCallInfo fcinfo = op->rowcompare_step.fcinfo_data; Datum d; /* force NULL result if strict fn and NULL input */ - if (op->d.rowcompare_step.finfo->fn_strict && + if (op->rowcompare_step.finfo->fn_strict && (fcinfo->args[0].isnull || fcinfo->args[1].isnull)) { *op->resnull = true; - EEO_JUMP(op->d.rowcompare_step.jumpnull); + EEO_JUMP(op->rowcompare_step.jumpnull); } /* Apply comparison function */ fcinfo->isnull = false; - d = op->d.rowcompare_step.fn_addr(fcinfo); + d = op->rowcompare_step.fn_addr(fcinfo); *op->resvalue = d; /* force NULL result if NULL function result */ if (fcinfo->isnull) { *op->resnull = true; - EEO_JUMP(op->d.rowcompare_step.jumpnull); + EEO_JUMP(op->rowcompare_step.jumpnull); } *op->resnull = false; /* If unequal, no need to compare remaining columns */ if (DatumGetInt32(*op->resvalue) != 0) { - EEO_JUMP(op->d.rowcompare_step.jumpdone); + EEO_JUMP(op->rowcompare_step.jumpdone); } EEO_NEXT(); @@ -1658,7 +1658,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_ROWCOMPARE_FINAL) { int32 cmpresult = DatumGetInt32(*op->resvalue); - CompareType cmptype = op->d.rowcompare_final.cmptype; + CompareType cmptype = op->rowcompare_final.cmptype; *op->resnull = false; switch (cmptype) @@ -1719,14 +1719,14 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_SBSREF_SUBSCRIPTS) { /* Precheck SubscriptingRef subscript(s) */ - if (op->d.sbsref_subscript.subscriptfunc(state, op, econtext)) + if (op->sbsref_subscript.subscriptfunc(state, op, econtext)) { EEO_NEXT(); } else { /* Subscript is null, short-circuit SubscriptingRef to NULL */ - EEO_JUMP(op->d.sbsref_subscript.jumpdone); + EEO_JUMP(op->sbsref_subscript.jumpdone); } } @@ -1735,7 +1735,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_SBSREF_FETCH) { /* Perform a SubscriptingRef fetch or assignment */ - op->d.sbsref.subscriptfunc(state, op, econtext); + op->sbsref.subscriptfunc(state, op, econtext); EEO_NEXT(); } @@ -1766,8 +1766,8 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_DOMAIN_TESTVAL) { - *op->resvalue = *op->d.casetest.value; - *op->resnull = *op->d.casetest.isnull; + *op->resvalue = *op->casetest.value; + *op->resnull = *op->casetest.isnull; EEO_NEXT(); } @@ -1798,7 +1798,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_HASHDATUM_SET_INITVAL) { - *op->resvalue = op->d.hashdatum_initvalue.init_value; + *op->resvalue = op->hashdatum_initvalue.init_value; *op->resnull = false; EEO_NEXT(); @@ -1806,14 +1806,14 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_HASHDATUM_FIRST) { - FunctionCallInfo fcinfo = op->d.hashdatum.fcinfo_data; + FunctionCallInfo fcinfo = op->hashdatum.fcinfo_data; /* * Save the Datum on non-null inputs, otherwise store 0 so that * subsequent NEXT32 operations combine with an initialized value. */ if (!fcinfo->args[0].isnull) - *op->resvalue = op->d.hashdatum.fn_addr(fcinfo); + *op->resvalue = op->hashdatum.fn_addr(fcinfo); else *op->resvalue = (Datum) 0; @@ -1824,7 +1824,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_HASHDATUM_FIRST_STRICT) { - FunctionCallInfo fcinfo = op->d.hashdatum.fcinfo_data; + FunctionCallInfo fcinfo = op->hashdatum.fcinfo_data; if (fcinfo->args[0].isnull) { @@ -1835,11 +1835,11 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) */ *op->resnull = true; *op->resvalue = (Datum) 0; - EEO_JUMP(op->d.hashdatum.jumpdone); + EEO_JUMP(op->hashdatum.jumpdone); } /* execute the hash function and save the resulting value */ - *op->resvalue = op->d.hashdatum.fn_addr(fcinfo); + *op->resvalue = op->hashdatum.fn_addr(fcinfo); *op->resnull = false; EEO_NEXT(); @@ -1847,10 +1847,10 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_HASHDATUM_NEXT32) { - FunctionCallInfo fcinfo = op->d.hashdatum.fcinfo_data; + FunctionCallInfo fcinfo = op->hashdatum.fcinfo_data; uint32 existinghash; - existinghash = DatumGetUInt32(op->d.hashdatum.iresult->value); + existinghash = DatumGetUInt32(op->hashdatum.iresult->value); /* combine successive hash values by rotating */ existinghash = pg_rotate_left32(existinghash, 1); @@ -1860,7 +1860,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) uint32 hashvalue; /* execute hash func and combine with previous hash value */ - hashvalue = DatumGetUInt32(op->d.hashdatum.fn_addr(fcinfo)); + hashvalue = DatumGetUInt32(op->hashdatum.fn_addr(fcinfo)); existinghash = existinghash ^ hashvalue; } @@ -1872,7 +1872,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_HASHDATUM_NEXT32_STRICT) { - FunctionCallInfo fcinfo = op->d.hashdatum.fcinfo_data; + FunctionCallInfo fcinfo = op->hashdatum.fcinfo_data; if (fcinfo->args[0].isnull) { @@ -1883,19 +1883,19 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) */ *op->resnull = true; *op->resvalue = (Datum) 0; - EEO_JUMP(op->d.hashdatum.jumpdone); + EEO_JUMP(op->hashdatum.jumpdone); } else { uint32 existinghash; uint32 hashvalue; - existinghash = DatumGetUInt32(op->d.hashdatum.iresult->value); + existinghash = DatumGetUInt32(op->hashdatum.iresult->value); /* combine successive hash values by rotating */ existinghash = pg_rotate_left32(existinghash, 1); /* execute hash func and combine with previous hash value */ - hashvalue = DatumGetUInt32(op->d.hashdatum.fn_addr(fcinfo)); + hashvalue = DatumGetUInt32(op->hashdatum.fn_addr(fcinfo)); *op->resvalue = UInt32GetDatum(existinghash ^ hashvalue); *op->resnull = false; } @@ -1954,7 +1954,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) * Returns a Datum whose value is the precomputed aggregate value * found in the given expression context. */ - int aggno = op->d.aggref.aggno; + int aggno = op->aggref.aggno; Assert(econtext->ecxt_aggvalues != NULL); @@ -1977,7 +1977,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) /* * Like Aggref, just return a precomputed value from the econtext. */ - WindowFuncExprState *wfunc = op->d.window_func.wfstate; + WindowFuncExprState *wfunc = op->window_func.wfstate; Assert(econtext->ecxt_aggvalues != NULL); @@ -2007,8 +2007,8 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_AGG_STRICT_DESERIALIZE) { /* Don't call a strict deserialization function with NULL input */ - if (op->d.agg_deserialize.fcinfo_data->args[0].isnull) - EEO_JUMP(op->d.agg_deserialize.jumpnull); + if (op->agg_deserialize.fcinfo_data->args[0].isnull) + EEO_JUMP(op->agg_deserialize.jumpnull); /* fallthrough */ } @@ -2016,7 +2016,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) /* evaluate aggregate deserialization function (non-strict portion) */ EEO_CASE(EEOP_AGG_DESERIALIZE) { - FunctionCallInfo fcinfo = op->d.agg_deserialize.fcinfo_data; + FunctionCallInfo fcinfo = op->agg_deserialize.fcinfo_data; AggState *aggstate = castNode(AggState, state->parent); MemoryContext oldContext; @@ -2041,15 +2041,15 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) /* when checking more than one argument */ EEO_CASE(EEOP_AGG_STRICT_INPUT_CHECK_ARGS) { - NullableDatum *args = op->d.agg_strict_input_check.args; - int nargs = op->d.agg_strict_input_check.nargs; + NullableDatum *args = op->agg_strict_input_check.args; + int nargs = op->agg_strict_input_check.nargs; Assert(nargs > 1); for (int argno = 0; argno < nargs; argno++) { if (args[argno].isnull) - EEO_JUMP(op->d.agg_strict_input_check.jumpnull); + EEO_JUMP(op->agg_strict_input_check.jumpnull); } EEO_NEXT(); } @@ -2057,25 +2057,25 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) /* special case for just one argument */ EEO_CASE(EEOP_AGG_STRICT_INPUT_CHECK_ARGS_1) { - NullableDatum *args = op->d.agg_strict_input_check.args; - PG_USED_FOR_ASSERTS_ONLY int nargs = op->d.agg_strict_input_check.nargs; + NullableDatum *args = op->agg_strict_input_check.args; + PG_USED_FOR_ASSERTS_ONLY int nargs = op->agg_strict_input_check.nargs; Assert(nargs == 1); if (args[0].isnull) - EEO_JUMP(op->d.agg_strict_input_check.jumpnull); + EEO_JUMP(op->agg_strict_input_check.jumpnull); EEO_NEXT(); } EEO_CASE(EEOP_AGG_STRICT_INPUT_CHECK_NULLS) { - bool *nulls = op->d.agg_strict_input_check.nulls; - int nargs = op->d.agg_strict_input_check.nargs; + bool *nulls = op->agg_strict_input_check.nulls; + int nargs = op->agg_strict_input_check.nargs; for (int argno = 0; argno < nargs; argno++) { if (nulls[argno]) - EEO_JUMP(op->d.agg_strict_input_check.jumpnull); + EEO_JUMP(op->agg_strict_input_check.jumpnull); } EEO_NEXT(); } @@ -2088,10 +2088,10 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) { AggState *aggstate = castNode(AggState, state->parent); AggStatePerGroup pergroup_allaggs = - aggstate->all_pergroups[op->d.agg_plain_pergroup_nullcheck.setoff]; + aggstate->all_pergroups[op->agg_plain_pergroup_nullcheck.setoff]; if (pergroup_allaggs == NULL) - EEO_JUMP(op->d.agg_plain_pergroup_nullcheck.jumpnull); + EEO_JUMP(op->agg_plain_pergroup_nullcheck.jumpnull); EEO_NEXT(); } @@ -2111,9 +2111,9 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYVAL) { AggState *aggstate = castNode(AggState, state->parent); - AggStatePerTrans pertrans = op->d.agg_trans.pertrans; + AggStatePerTrans pertrans = op->agg_trans.pertrans; AggStatePerGroup pergroup = - &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno]; + &aggstate->all_pergroups[op->agg_trans.setoff][op->agg_trans.transno]; Assert(pertrans->transtypeByVal); @@ -2121,15 +2121,15 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) { /* If transValue has not yet been initialized, do so now. */ ExecAggInitGroup(aggstate, pertrans, pergroup, - op->d.agg_trans.aggcontext); + op->agg_trans.aggcontext); /* copied trans value from input, done this round */ } else if (likely(!pergroup->transValueIsNull)) { /* invoke transition function, unless prevented by strictness */ ExecAggPlainTransByVal(aggstate, pertrans, pergroup, - op->d.agg_trans.aggcontext, - op->d.agg_trans.setno); + op->agg_trans.aggcontext, + op->agg_trans.setno); } EEO_NEXT(); @@ -2139,16 +2139,16 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_AGG_PLAIN_TRANS_STRICT_BYVAL) { AggState *aggstate = castNode(AggState, state->parent); - AggStatePerTrans pertrans = op->d.agg_trans.pertrans; + AggStatePerTrans pertrans = op->agg_trans.pertrans; AggStatePerGroup pergroup = - &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno]; + &aggstate->all_pergroups[op->agg_trans.setoff][op->agg_trans.transno]; Assert(pertrans->transtypeByVal); if (likely(!pergroup->transValueIsNull)) ExecAggPlainTransByVal(aggstate, pertrans, pergroup, - op->d.agg_trans.aggcontext, - op->d.agg_trans.setno); + op->agg_trans.aggcontext, + op->agg_trans.setno); EEO_NEXT(); } @@ -2157,15 +2157,15 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_AGG_PLAIN_TRANS_BYVAL) { AggState *aggstate = castNode(AggState, state->parent); - AggStatePerTrans pertrans = op->d.agg_trans.pertrans; + AggStatePerTrans pertrans = op->agg_trans.pertrans; AggStatePerGroup pergroup = - &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno]; + &aggstate->all_pergroups[op->agg_trans.setoff][op->agg_trans.transno]; Assert(pertrans->transtypeByVal); ExecAggPlainTransByVal(aggstate, pertrans, pergroup, - op->d.agg_trans.aggcontext, - op->d.agg_trans.setno); + op->agg_trans.aggcontext, + op->agg_trans.setno); EEO_NEXT(); } @@ -2174,19 +2174,19 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYREF) { AggState *aggstate = castNode(AggState, state->parent); - AggStatePerTrans pertrans = op->d.agg_trans.pertrans; + AggStatePerTrans pertrans = op->agg_trans.pertrans; AggStatePerGroup pergroup = - &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno]; + &aggstate->all_pergroups[op->agg_trans.setoff][op->agg_trans.transno]; Assert(!pertrans->transtypeByVal); if (pergroup->noTransValue) ExecAggInitGroup(aggstate, pertrans, pergroup, - op->d.agg_trans.aggcontext); + op->agg_trans.aggcontext); else if (likely(!pergroup->transValueIsNull)) ExecAggPlainTransByRef(aggstate, pertrans, pergroup, - op->d.agg_trans.aggcontext, - op->d.agg_trans.setno); + op->agg_trans.aggcontext, + op->agg_trans.setno); EEO_NEXT(); } @@ -2195,16 +2195,16 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_AGG_PLAIN_TRANS_STRICT_BYREF) { AggState *aggstate = castNode(AggState, state->parent); - AggStatePerTrans pertrans = op->d.agg_trans.pertrans; + AggStatePerTrans pertrans = op->agg_trans.pertrans; AggStatePerGroup pergroup = - &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno]; + &aggstate->all_pergroups[op->agg_trans.setoff][op->agg_trans.transno]; Assert(!pertrans->transtypeByVal); if (likely(!pergroup->transValueIsNull)) ExecAggPlainTransByRef(aggstate, pertrans, pergroup, - op->d.agg_trans.aggcontext, - op->d.agg_trans.setno); + op->agg_trans.aggcontext, + op->agg_trans.setno); EEO_NEXT(); } @@ -2212,39 +2212,39 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) EEO_CASE(EEOP_AGG_PLAIN_TRANS_BYREF) { AggState *aggstate = castNode(AggState, state->parent); - AggStatePerTrans pertrans = op->d.agg_trans.pertrans; + AggStatePerTrans pertrans = op->agg_trans.pertrans; AggStatePerGroup pergroup = - &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno]; + &aggstate->all_pergroups[op->agg_trans.setoff][op->agg_trans.transno]; Assert(!pertrans->transtypeByVal); ExecAggPlainTransByRef(aggstate, pertrans, pergroup, - op->d.agg_trans.aggcontext, - op->d.agg_trans.setno); + op->agg_trans.aggcontext, + op->agg_trans.setno); EEO_NEXT(); } EEO_CASE(EEOP_AGG_PRESORTED_DISTINCT_SINGLE) { - AggStatePerTrans pertrans = op->d.agg_presorted_distinctcheck.pertrans; + AggStatePerTrans pertrans = op->agg_presorted_distinctcheck.pertrans; AggState *aggstate = castNode(AggState, state->parent); if (ExecEvalPreOrderedDistinctSingle(aggstate, pertrans)) EEO_NEXT(); else - EEO_JUMP(op->d.agg_presorted_distinctcheck.jumpdistinct); + EEO_JUMP(op->agg_presorted_distinctcheck.jumpdistinct); } EEO_CASE(EEOP_AGG_PRESORTED_DISTINCT_MULTI) { AggState *aggstate = castNode(AggState, state->parent); - AggStatePerTrans pertrans = op->d.agg_presorted_distinctcheck.pertrans; + AggStatePerTrans pertrans = op->agg_presorted_distinctcheck.pertrans; if (ExecEvalPreOrderedDistinctMulti(aggstate, pertrans)) EEO_NEXT(); else - EEO_JUMP(op->d.agg_presorted_distinctcheck.jumpdistinct); + EEO_JUMP(op->agg_presorted_distinctcheck.jumpdistinct); } /* process single-column ordered aggregate datum */ @@ -2326,41 +2326,41 @@ CheckExprStillValid(ExprState *state, ExprContext *econtext) { case EEOP_INNER_VAR: { - int attnum = op->d.var.attnum; + int attnum = op->var.attnum; - CheckVarSlotCompatibility(innerslot, attnum + 1, op->d.var.vartype); + CheckVarSlotCompatibility(innerslot, attnum + 1, op->var.vartype); break; } case EEOP_OUTER_VAR: { - int attnum = op->d.var.attnum; + int attnum = op->var.attnum; - CheckVarSlotCompatibility(outerslot, attnum + 1, op->d.var.vartype); + CheckVarSlotCompatibility(outerslot, attnum + 1, op->var.vartype); break; } case EEOP_SCAN_VAR: { - int attnum = op->d.var.attnum; + int attnum = op->var.attnum; - CheckVarSlotCompatibility(scanslot, attnum + 1, op->d.var.vartype); + CheckVarSlotCompatibility(scanslot, attnum + 1, op->var.vartype); break; } case EEOP_OLD_VAR: { - int attnum = op->d.var.attnum; + int attnum = op->var.attnum; - CheckVarSlotCompatibility(oldslot, attnum + 1, op->d.var.vartype); + CheckVarSlotCompatibility(oldslot, attnum + 1, op->var.vartype); break; } case EEOP_NEW_VAR: { - int attnum = op->d.var.attnum; + int attnum = op->var.attnum; - CheckVarSlotCompatibility(newslot, attnum + 1, op->d.var.vartype); + CheckVarSlotCompatibility(newslot, attnum + 1, op->var.vartype); break; } default: @@ -2434,7 +2434,7 @@ CheckOpSlotCompatibility(ExprEvalStep *op, TupleTableSlot *slot) { #ifdef USE_ASSERT_CHECKING /* there's nothing to check */ - if (!op->d.fetch.fixed) + if (!op->fetch.fixed) return; /* @@ -2442,10 +2442,10 @@ CheckOpSlotCompatibility(ExprEvalStep *op, TupleTableSlot *slot) * buffer and heap tuples to be used interchangeably. */ if (slot->tts_ops == &TTSOpsBufferHeapTuple && - op->d.fetch.kind == &TTSOpsHeapTuple) + op->fetch.kind == &TTSOpsHeapTuple) return; if (slot->tts_ops == &TTSOpsHeapTuple && - op->d.fetch.kind == &TTSOpsBufferHeapTuple) + op->fetch.kind == &TTSOpsBufferHeapTuple) return; /* @@ -2455,7 +2455,7 @@ CheckOpSlotCompatibility(ExprEvalStep *op, TupleTableSlot *slot) if (slot->tts_ops == &TTSOpsVirtual) return; - Assert(op->d.fetch.kind == slot->tts_ops); + Assert(op->fetch.kind == slot->tts_ops); #endif } @@ -2546,7 +2546,7 @@ static pg_attribute_always_inline Datum ExecJustVarImpl(ExprState *state, TupleTableSlot *slot, bool *isnull) { ExprEvalStep *op = &state->steps[1]; - int attnum = op->d.var.attnum + 1; + int attnum = op->var.attnum + 1; CheckOpSlotCompatibility(&state->steps[0], slot); @@ -2584,8 +2584,8 @@ static pg_attribute_always_inline Datum ExecJustAssignVarImpl(ExprState *state, TupleTableSlot *inslot, bool *isnull) { ExprEvalStep *op = &state->steps[1]; - int attnum = op->d.assign_var.attnum + 1; - int resultnum = op->d.assign_var.resultnum; + int attnum = op->assign_var.attnum + 1; + int resultnum = op->assign_var.resultnum; TupleTableSlot *outslot = state->resultslot; CheckOpSlotCompatibility(&state->steps[0], inslot); @@ -2640,13 +2640,13 @@ ExecJustApplyFuncToCase(ExprState *state, ExprContext *econtext, bool *isnull) * XXX with some redesign of the CaseTestExpr mechanism, maybe we could * get rid of this data shuffling? */ - *op->resvalue = *op->d.casetest.value; - *op->resnull = *op->d.casetest.isnull; + *op->resvalue = *op->casetest.value; + *op->resnull = *op->casetest.isnull; op++; - nargs = op->d.func.nargs; - fcinfo = op->d.func.fcinfo_data; + nargs = op->func.nargs; + fcinfo = op->func.fcinfo_data; args = fcinfo->args; /* strict function, so check for NULL args */ @@ -2659,7 +2659,7 @@ ExecJustApplyFuncToCase(ExprState *state, ExprContext *econtext, bool *isnull) } } fcinfo->isnull = false; - d = op->d.func.fn_addr(fcinfo); + d = op->func.fn_addr(fcinfo); *isnull = fcinfo->isnull; return d; } @@ -2670,8 +2670,8 @@ ExecJustConst(ExprState *state, ExprContext *econtext, bool *isnull) { ExprEvalStep *op = &state->steps[0]; - *isnull = op->d.constval.isnull; - return op->d.constval.value; + *isnull = op->constval.isnull; + return op->constval.value; } /* implementation of ExecJust(Inner|Outer|Scan)VarVirt */ @@ -2679,7 +2679,7 @@ static pg_attribute_always_inline Datum ExecJustVarVirtImpl(ExprState *state, TupleTableSlot *slot, bool *isnull) { ExprEvalStep *op = &state->steps[0]; - int attnum = op->d.var.attnum; + int attnum = op->var.attnum; /* * As it is guaranteed that a virtual slot is used, there never is a need @@ -2722,8 +2722,8 @@ static pg_attribute_always_inline Datum ExecJustAssignVarVirtImpl(ExprState *state, TupleTableSlot *inslot, bool *isnull) { ExprEvalStep *op = &state->steps[0]; - int attnum = op->d.assign_var.attnum; - int resultnum = op->d.assign_var.resultnum; + int attnum = op->assign_var.attnum; + int resultnum = op->assign_var.resultnum; TupleTableSlot *outslot = state->resultslot; /* see ExecJustVarVirtImpl for comments */ @@ -2771,24 +2771,24 @@ ExecJustHashInnerVarWithIV(ExprState *state, ExprContext *econtext, ExprEvalStep *setivop = &state->steps[1]; ExprEvalStep *innervar = &state->steps[2]; ExprEvalStep *hashop = &state->steps[3]; - FunctionCallInfo fcinfo = hashop->d.hashdatum.fcinfo_data; - int attnum = innervar->d.var.attnum; + FunctionCallInfo fcinfo = hashop->hashdatum.fcinfo_data; + int attnum = innervar->var.attnum; uint32 hashkey; CheckOpSlotCompatibility(fetchop, econtext->ecxt_innertuple); - slot_getsomeattrs(econtext->ecxt_innertuple, fetchop->d.fetch.last_var); + slot_getsomeattrs(econtext->ecxt_innertuple, fetchop->fetch.last_var); fcinfo->args[0].value = econtext->ecxt_innertuple->tts_values[attnum]; fcinfo->args[0].isnull = econtext->ecxt_innertuple->tts_isnull[attnum]; - hashkey = DatumGetUInt32(setivop->d.hashdatum_initvalue.init_value); + hashkey = DatumGetUInt32(setivop->hashdatum_initvalue.init_value); hashkey = pg_rotate_left32(hashkey, 1); if (!fcinfo->args[0].isnull) { uint32 hashvalue; - hashvalue = DatumGetUInt32(hashop->d.hashdatum.fn_addr(fcinfo)); + hashvalue = DatumGetUInt32(hashop->hashdatum.fn_addr(fcinfo)); hashkey = hashkey ^ hashvalue; } @@ -2803,11 +2803,11 @@ ExecJustHashVarImpl(ExprState *state, TupleTableSlot *slot, bool *isnull) ExprEvalStep *fetchop = &state->steps[0]; ExprEvalStep *var = &state->steps[1]; ExprEvalStep *hashop = &state->steps[2]; - FunctionCallInfo fcinfo = hashop->d.hashdatum.fcinfo_data; - int attnum = var->d.var.attnum; + FunctionCallInfo fcinfo = hashop->hashdatum.fcinfo_data; + int attnum = var->var.attnum; CheckOpSlotCompatibility(fetchop, slot); - slot_getsomeattrs(slot, fetchop->d.fetch.last_var); + slot_getsomeattrs(slot, fetchop->fetch.last_var); fcinfo->args[0].value = slot->tts_values[attnum]; fcinfo->args[0].isnull = slot->tts_isnull[attnum]; @@ -2815,7 +2815,7 @@ ExecJustHashVarImpl(ExprState *state, TupleTableSlot *slot, bool *isnull) *isnull = false; if (!fcinfo->args[0].isnull) - return hashop->d.hashdatum.fn_addr(fcinfo); + return hashop->hashdatum.fn_addr(fcinfo); else return (Datum) 0; } @@ -2840,8 +2840,8 @@ ExecJustHashVarVirtImpl(ExprState *state, TupleTableSlot *slot, bool *isnull) { ExprEvalStep *var = &state->steps[0]; ExprEvalStep *hashop = &state->steps[1]; - FunctionCallInfo fcinfo = hashop->d.hashdatum.fcinfo_data; - int attnum = var->d.var.attnum; + FunctionCallInfo fcinfo = hashop->hashdatum.fcinfo_data; + int attnum = var->var.attnum; fcinfo->args[0].value = slot->tts_values[attnum]; fcinfo->args[0].isnull = slot->tts_isnull[attnum]; @@ -2849,7 +2849,7 @@ ExecJustHashVarVirtImpl(ExprState *state, TupleTableSlot *slot, bool *isnull) *isnull = false; if (!fcinfo->args[0].isnull) - return hashop->d.hashdatum.fn_addr(fcinfo); + return hashop->hashdatum.fn_addr(fcinfo); else return (Datum) 0; } @@ -2880,11 +2880,11 @@ ExecJustHashOuterVarStrict(ExprState *state, ExprContext *econtext, ExprEvalStep *fetchop = &state->steps[0]; ExprEvalStep *var = &state->steps[1]; ExprEvalStep *hashop = &state->steps[2]; - FunctionCallInfo fcinfo = hashop->d.hashdatum.fcinfo_data; - int attnum = var->d.var.attnum; + FunctionCallInfo fcinfo = hashop->hashdatum.fcinfo_data; + int attnum = var->var.attnum; CheckOpSlotCompatibility(fetchop, econtext->ecxt_outertuple); - slot_getsomeattrs(econtext->ecxt_outertuple, fetchop->d.fetch.last_var); + slot_getsomeattrs(econtext->ecxt_outertuple, fetchop->fetch.last_var); fcinfo->args[0].value = econtext->ecxt_outertuple->tts_values[attnum]; fcinfo->args[0].isnull = econtext->ecxt_outertuple->tts_isnull[attnum]; @@ -2892,7 +2892,7 @@ ExecJustHashOuterVarStrict(ExprState *state, ExprContext *econtext, if (!fcinfo->args[0].isnull) { *isnull = false; - return hashop->d.hashdatum.fn_addr(fcinfo); + return hashop->hashdatum.fn_addr(fcinfo); } else { @@ -2990,14 +2990,14 @@ void ExecEvalFuncExprFusage(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - FunctionCallInfo fcinfo = op->d.func.fcinfo_data; + FunctionCallInfo fcinfo = op->func.fcinfo_data; PgStat_FunctionCallUsage fcusage; Datum d; pgstat_init_function_usage(fcinfo, &fcusage); fcinfo->isnull = false; - d = op->d.func.fn_addr(fcinfo); + d = op->func.fn_addr(fcinfo); *op->resvalue = d; *op->resnull = fcinfo->isnull; @@ -3012,10 +3012,10 @@ ExecEvalFuncExprStrictFusage(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - FunctionCallInfo fcinfo = op->d.func.fcinfo_data; + FunctionCallInfo fcinfo = op->func.fcinfo_data; PgStat_FunctionCallUsage fcusage; NullableDatum *args = fcinfo->args; - int nargs = op->d.func.nargs; + int nargs = op->func.nargs; Datum d; /* strict function, so check for NULL args */ @@ -3031,7 +3031,7 @@ ExecEvalFuncExprStrictFusage(ExprState *state, ExprEvalStep *op, pgstat_init_function_usage(fcinfo, &fcusage); fcinfo->isnull = false; - d = op->d.func.fn_addr(fcinfo); + d = op->func.fn_addr(fcinfo); *op->resvalue = d; *op->resnull = fcinfo->isnull; @@ -3049,7 +3049,7 @@ ExecEvalParamExec(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { ParamExecData *prm; - prm = &(econtext->ecxt_param_exec_vals[op->d.param.paramid]); + prm = &(econtext->ecxt_param_exec_vals[op->param.paramid]); if (unlikely(prm->execPlan != NULL)) { /* Parameter not evaluated yet, so go do it */ @@ -3070,7 +3070,7 @@ void ExecEvalParamExtern(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { ParamListInfo paramInfo = econtext->ecxt_param_list_info; - int paramId = op->d.param.paramid; + int paramId = op->param.paramid; if (likely(paramInfo && paramId > 0 && paramId <= paramInfo->numParams)) @@ -3087,13 +3087,13 @@ ExecEvalParamExtern(ExprState *state, ExprEvalStep *op, ExprContext *econtext) if (likely(OidIsValid(prm->ptype))) { /* safety check in case hook did something unexpected */ - if (unlikely(prm->ptype != op->d.param.paramtype)) + if (unlikely(prm->ptype != op->param.paramtype)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("type of parameter %d (%s) does not match that when preparing the plan (%s)", paramId, format_type_be(prm->ptype), - format_type_be(op->d.param.paramtype)))); + format_type_be(op->param.paramtype)))); *op->resvalue = prm->value; *op->resnull = prm->isnull; return; @@ -3114,7 +3114,7 @@ ExecEvalParamSet(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { ParamExecData *prm; - prm = &(econtext->ecxt_param_exec_vals[op->d.param.paramid]); + prm = &(econtext->ecxt_param_exec_vals[op->param.paramid]); /* Shouldn't have a pending evaluation anymore */ Assert(prm->execPlan == NULL); @@ -3146,7 +3146,7 @@ ExecEvalCoerceViaIOSafe(ExprState *state, ExprEvalStep *op) { FunctionCallInfo fcinfo_out; - fcinfo_out = op->d.iocoerce.fcinfo_data_out; + fcinfo_out = op->iocoerce.fcinfo_data_out; fcinfo_out->args[0].value = *op->resvalue; fcinfo_out->args[0].isnull = false; @@ -3158,11 +3158,11 @@ ExecEvalCoerceViaIOSafe(ExprState *state, ExprEvalStep *op) } /* call input function (similar to InputFunctionCallSafe) */ - if (!op->d.iocoerce.finfo_in->fn_strict || str != NULL) + if (!op->iocoerce.finfo_in->fn_strict || str != NULL) { FunctionCallInfo fcinfo_in; - fcinfo_in = op->d.iocoerce.fcinfo_data_in; + fcinfo_in = op->iocoerce.fcinfo_data_in; fcinfo_in->args[0].value = PointerGetDatum(str); fcinfo_in->args[0].isnull = *op->resnull; /* second and third arguments are already set up */ @@ -3195,7 +3195,7 @@ void ExecEvalSQLValueFunction(ExprState *state, ExprEvalStep *op) { LOCAL_FCINFO(fcinfo, 0); - SQLValueFunction *svf = op->d.sqlvaluefunction.svf; + SQLValueFunction *svf = op->sqlvaluefunction.svf; *op->resnull = false; @@ -3272,9 +3272,9 @@ ExecEvalCurrentOfExpr(ExprState *state, ExprEvalStep *op) void ExecEvalNextValueExpr(ExprState *state, ExprEvalStep *op) { - int64 newval = nextval_internal(op->d.nextvalueexpr.seqid, false); + int64 newval = nextval_internal(op->nextvalueexpr.seqid, false); - switch (op->d.nextvalueexpr.seqtypid) + switch (op->nextvalueexpr.seqtypid) { case INT2OID: *op->resvalue = Int16GetDatum((int16) newval); @@ -3287,7 +3287,7 @@ ExecEvalNextValueExpr(ExprState *state, ExprEvalStep *op) break; default: elog(ERROR, "unsupported sequence type %u", - op->d.nextvalueexpr.seqtypid); + op->nextvalueexpr.seqtypid); } *op->resnull = false; } @@ -3355,7 +3355,7 @@ ExecEvalRowNullInt(ExprState *state, ExprEvalStep *op, /* Lookup tupdesc if first time through or if type changes */ tupDesc = get_cached_rowtype(tupType, tupTypmod, - &op->d.nulltest_row.rowcache, NULL); + &op->nulltest_row.rowcache, NULL); /* * heap_attisnull needs a HeapTuple not a bare HeapTupleHeader. @@ -3395,14 +3395,14 @@ ExecEvalRowNullInt(ExprState *state, ExprEvalStep *op, * Evaluate an ARRAY[] expression. * * The individual array elements (or subarrays) have already been evaluated - * into op->d.arrayexpr.elemvalues[]/elemnulls[]. + * into op->arrayexpr.elemvalues[]/elemnulls[]. */ void ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op) { ArrayType *result; - Oid element_type = op->d.arrayexpr.elemtype; - int nelems = op->d.arrayexpr.nelems; + Oid element_type = op->arrayexpr.elemtype; + int nelems = op->arrayexpr.nelems; int ndims = 0; int dims[MAXDIM]; int lbs[MAXDIM]; @@ -3410,11 +3410,11 @@ ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op) /* Set non-null as default */ *op->resnull = false; - if (!op->d.arrayexpr.multidims) + if (!op->arrayexpr.multidims) { /* Elements are presumably of scalar type */ - Datum *dvalues = op->d.arrayexpr.elemvalues; - bool *dnulls = op->d.arrayexpr.elemnulls; + Datum *dvalues = op->arrayexpr.elemvalues; + bool *dnulls = op->arrayexpr.elemnulls; /* setup for 1-D array of the given length */ ndims = 1; @@ -3423,9 +3423,9 @@ ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op) result = construct_md_array(dvalues, dnulls, ndims, dims, lbs, element_type, - op->d.arrayexpr.elemlength, - op->d.arrayexpr.elembyval, - op->d.arrayexpr.elemalign); + op->arrayexpr.elemlength, + op->arrayexpr.elembyval, + op->arrayexpr.elemalign); } else { @@ -3460,8 +3460,8 @@ ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op) ArrayType *array; int this_ndims; - arraydatum = op->d.arrayexpr.elemvalues[elemoff]; - eisnull = op->d.arrayexpr.elemnulls[elemoff]; + arraydatum = op->arrayexpr.elemvalues[elemoff]; + eisnull = op->arrayexpr.elemnulls[elemoff]; /* temporarily ignore null subarrays */ if (eisnull) @@ -3626,12 +3626,12 @@ ExecEvalArrayCoerce(ExprState *state, ExprEvalStep *op, ExprContext *econtext) * If it's binary-compatible, modify the element type in the array header, * but otherwise leave the array as we received it. */ - if (op->d.arraycoerce.elemexprstate == NULL) + if (op->arraycoerce.elemexprstate == NULL) { /* Detoast input array if necessary, and copy in any case */ ArrayType *array = DatumGetArrayTypePCopy(arraydatum); - ARR_ELEMTYPE(array) = op->d.arraycoerce.resultelemtype; + ARR_ELEMTYPE(array) = op->arraycoerce.resultelemtype; *op->resvalue = PointerGetDatum(array); return; } @@ -3640,17 +3640,17 @@ ExecEvalArrayCoerce(ExprState *state, ExprEvalStep *op, ExprContext *econtext) * Use array_map to apply the sub-expression to each array element. */ *op->resvalue = array_map(arraydatum, - op->d.arraycoerce.elemexprstate, + op->arraycoerce.elemexprstate, econtext, - op->d.arraycoerce.resultelemtype, - op->d.arraycoerce.amstate); + op->arraycoerce.resultelemtype, + op->arraycoerce.amstate); } /* * Evaluate a ROW() expression. * * The individual columns have already been evaluated into - * op->d.row.elemvalues[]/elemnulls[]. + * op->row.elemvalues[]/elemnulls[]. */ void ExecEvalRow(ExprState *state, ExprEvalStep *op) @@ -3658,9 +3658,9 @@ ExecEvalRow(ExprState *state, ExprEvalStep *op) HeapTuple tuple; /* build tuple from evaluated field values */ - tuple = heap_form_tuple(op->d.row.tupdesc, - op->d.row.elemvalues, - op->d.row.elemnulls); + tuple = heap_form_tuple(op->row.tupdesc, + op->row.elemvalues, + op->row.elemnulls); *op->resvalue = HeapTupleGetDatum(tuple); *op->resnull = false; @@ -3670,15 +3670,15 @@ ExecEvalRow(ExprState *state, ExprEvalStep *op) * Evaluate GREATEST() or LEAST() expression (note this is *not* MIN()/MAX()). * * All of the to-be-compared expressions have already been evaluated into - * op->d.minmax.values[]/nulls[]. + * op->minmax.values[]/nulls[]. */ void ExecEvalMinMax(ExprState *state, ExprEvalStep *op) { - Datum *values = op->d.minmax.values; - bool *nulls = op->d.minmax.nulls; - FunctionCallInfo fcinfo = op->d.minmax.fcinfo_data; - MinMaxOp operator = op->d.minmax.op; + Datum *values = op->minmax.values; + bool *nulls = op->minmax.nulls; + FunctionCallInfo fcinfo = op->minmax.fcinfo_data; + MinMaxOp operator = op->minmax.op; /* set at initialization */ Assert(fcinfo->args[0].isnull == false); @@ -3687,7 +3687,7 @@ ExecEvalMinMax(ExprState *state, ExprEvalStep *op) /* default to null result */ *op->resnull = true; - for (int off = 0; off < op->d.minmax.nelems; off++) + for (int off = 0; off < op->minmax.nelems; off++) { /* ignore NULL inputs */ if (nulls[off]) @@ -3728,7 +3728,7 @@ ExecEvalMinMax(ExprState *state, ExprEvalStep *op) void ExecEvalFieldSelect(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - AttrNumber fieldnum = op->d.fieldselect.fieldnum; + AttrNumber fieldnum = op->fieldselect.fieldnum; Datum tupDatum; HeapTupleHeader tuple; Oid tupType; @@ -3775,13 +3775,13 @@ ExecEvalFieldSelect(ExprState *state, ExprEvalStep *op, ExprContext *econtext) /* Check for type mismatch --- possible after ALTER COLUMN TYPE? */ /* As in CheckVarSlotCompatibility, we should but can't check typmod */ - if (op->d.fieldselect.resulttype != attr->atttypid) + if (op->fieldselect.resulttype != attr->atttypid) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("attribute %d has wrong type", fieldnum), errdetail("Table has type %s, but query expects %s.", format_type_be(attr->atttypid), - format_type_be(op->d.fieldselect.resulttype)))); + format_type_be(op->fieldselect.resulttype)))); /* extract the field */ *op->resvalue = expanded_record_get_field(erh, fieldnum, @@ -3797,7 +3797,7 @@ ExecEvalFieldSelect(ExprState *state, ExprEvalStep *op, ExprContext *econtext) /* Lookup tupdesc if first time through or if type changes */ tupDesc = get_cached_rowtype(tupType, tupTypmod, - &op->d.fieldselect.rowcache, NULL); + &op->fieldselect.rowcache, NULL); /* * Find field's attr record. Note we don't support system columns @@ -3821,13 +3821,13 @@ ExecEvalFieldSelect(ExprState *state, ExprEvalStep *op, ExprContext *econtext) /* Check for type mismatch --- possible after ALTER COLUMN TYPE? */ /* As in CheckVarSlotCompatibility, we should but can't check typmod */ - if (op->d.fieldselect.resulttype != attr->atttypid) + if (op->fieldselect.resulttype != attr->atttypid) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("attribute %d has wrong type", fieldnum), errdetail("Table has type %s, but query expects %s.", format_type_be(attr->atttypid), - format_type_be(op->d.fieldselect.resulttype)))); + format_type_be(op->fieldselect.resulttype)))); /* heap_getattr needs a HeapTuple not a bare HeapTupleHeader */ tmptup.t_len = HeapTupleHeaderGetDatumLength(tuple); @@ -3856,8 +3856,8 @@ ExecEvalFieldStoreDeForm(ExprState *state, ExprEvalStep *op, ExprContext *econte if (*op->resnull) { /* Convert null input tuple into an all-nulls row */ - memset(op->d.fieldstore.nulls, true, - op->d.fieldstore.ncolumns * sizeof(bool)); + memset(op->fieldstore.nulls, true, + op->fieldstore.ncolumns * sizeof(bool)); } else { @@ -3882,17 +3882,17 @@ ExecEvalFieldStoreDeForm(ExprState *state, ExprEvalStep *op, ExprContext *econte * doing DatumGetHeapTupleHeader: that could do database access while * detoasting the datum. */ - tupDesc = get_cached_rowtype(op->d.fieldstore.fstore->resulttype, -1, - op->d.fieldstore.rowcache, NULL); + tupDesc = get_cached_rowtype(op->fieldstore.fstore->resulttype, -1, + op->fieldstore.rowcache, NULL); /* Check that current tupdesc doesn't have more fields than allocated */ - if (unlikely(tupDesc->natts > op->d.fieldstore.ncolumns)) + if (unlikely(tupDesc->natts > op->fieldstore.ncolumns)) elog(ERROR, "too many columns in composite type %u", - op->d.fieldstore.fstore->resulttype); + op->fieldstore.fstore->resulttype); heap_deform_tuple(&tmptup, tupDesc, - op->d.fieldstore.values, - op->d.fieldstore.nulls); + op->fieldstore.values, + op->fieldstore.nulls); } } @@ -3907,12 +3907,12 @@ ExecEvalFieldStoreForm(ExprState *state, ExprEvalStep *op, ExprContext *econtext HeapTuple tuple; /* Lookup tupdesc (should be valid already) */ - tupDesc = get_cached_rowtype(op->d.fieldstore.fstore->resulttype, -1, - op->d.fieldstore.rowcache, NULL); + tupDesc = get_cached_rowtype(op->fieldstore.fstore->resulttype, -1, + op->fieldstore.rowcache, NULL); tuple = heap_form_tuple(tupDesc, - op->d.fieldstore.values, - op->d.fieldstore.nulls); + op->fieldstore.values, + op->fieldstore.nulls); *op->resvalue = HeapTupleGetDatum(tuple); *op->resnull = false; @@ -3947,12 +3947,12 @@ ExecEvalConvertRowtype(ExprState *state, ExprEvalStep *op, ExprContext *econtext * pin them since type conversion functions could do catalog lookups and * hence cause cache invalidation. */ - indesc = get_cached_rowtype(op->d.convert_rowtype.inputtype, -1, - op->d.convert_rowtype.incache, + indesc = get_cached_rowtype(op->convert_rowtype.inputtype, -1, + op->convert_rowtype.incache, &changed); IncrTupleDescRefCount(indesc); - outdesc = get_cached_rowtype(op->d.convert_rowtype.outputtype, -1, - op->d.convert_rowtype.outcache, + outdesc = get_cached_rowtype(op->convert_rowtype.outputtype, -1, + op->convert_rowtype.outcache, &changed); IncrTupleDescRefCount(outdesc); @@ -3974,7 +3974,7 @@ ExecEvalConvertRowtype(ExprState *state, ExprEvalStep *op, ExprContext *econtext old_cxt = MemoryContextSwitchTo(econtext->ecxt_per_query_memory); /* prepare map from old to new attribute numbers */ - op->d.convert_rowtype.map = convert_tuples_by_name(indesc, outdesc); + op->convert_rowtype.map = convert_tuples_by_name(indesc, outdesc); MemoryContextSwitchTo(old_cxt); } @@ -3983,10 +3983,10 @@ ExecEvalConvertRowtype(ExprState *state, ExprEvalStep *op, ExprContext *econtext tmptup.t_len = HeapTupleHeaderGetDatumLength(tuple); tmptup.t_data = tuple; - if (op->d.convert_rowtype.map != NULL) + if (op->convert_rowtype.map != NULL) { /* Full conversion with attribute rearrangement needed */ - result = execute_attr_map_tuple(&tmptup, op->d.convert_rowtype.map); + result = execute_attr_map_tuple(&tmptup, op->convert_rowtype.map); /* Result already has appropriate composite-datum header fields */ *op->resvalue = HeapTupleGetDatum(result); } @@ -4022,9 +4022,9 @@ ExecEvalConvertRowtype(ExprState *state, ExprEvalStep *op, ExprContext *econtext void ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op) { - FunctionCallInfo fcinfo = op->d.scalararrayop.fcinfo_data; - bool useOr = op->d.scalararrayop.useOr; - bool strictfunc = op->d.scalararrayop.finfo->fn_strict; + FunctionCallInfo fcinfo = op->scalararrayop.fcinfo_data; + bool useOr = op->scalararrayop.useOr; + bool strictfunc = op->scalararrayop.finfo->fn_strict; ArrayType *arr; int nitems; Datum result; @@ -4074,18 +4074,18 @@ ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op) * We arrange to look up info about the element type only once per series * of calls, assuming the element type doesn't change underneath us. */ - if (op->d.scalararrayop.element_type != ARR_ELEMTYPE(arr)) + if (op->scalararrayop.element_type != ARR_ELEMTYPE(arr)) { get_typlenbyvalalign(ARR_ELEMTYPE(arr), - &op->d.scalararrayop.typlen, - &op->d.scalararrayop.typbyval, - &op->d.scalararrayop.typalign); - op->d.scalararrayop.element_type = ARR_ELEMTYPE(arr); + &op->scalararrayop.typlen, + &op->scalararrayop.typbyval, + &op->scalararrayop.typalign); + op->scalararrayop.element_type = ARR_ELEMTYPE(arr); } - typlen = op->d.scalararrayop.typlen; - typbyval = op->d.scalararrayop.typbyval; - typalign = op->d.scalararrayop.typalign; + typlen = op->scalararrayop.typlen; + typbyval = op->scalararrayop.typbyval; + typalign = op->scalararrayop.typalign; /* Initialize result appropriately depending on useOr */ result = BoolGetDatum(!useOr); @@ -4125,7 +4125,7 @@ ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op) else { fcinfo->isnull = false; - thisresult = op->d.scalararrayop.fn_addr(fcinfo); + thisresult = op->scalararrayop.fn_addr(fcinfo); } /* Combine results per OR or AND semantics */ @@ -4197,14 +4197,14 @@ saop_hash_element_match(struct saophash_hash *tb, Datum key1, Datum key2) Datum result; ScalarArrayOpExprHashTable *elements_tab = (ScalarArrayOpExprHashTable *) tb->private_data; - FunctionCallInfo fcinfo = elements_tab->op->d.hashedscalararrayop.fcinfo_data; + FunctionCallInfo fcinfo = elements_tab->op->hashedscalararrayop.fcinfo_data; fcinfo->args[0].value = key1; fcinfo->args[0].isnull = false; fcinfo->args[1].value = key2; fcinfo->args[1].isnull = false; - result = elements_tab->op->d.hashedscalararrayop.finfo->fn_addr(fcinfo); + result = elements_tab->op->hashedscalararrayop.finfo->fn_addr(fcinfo); return DatumGetBool(result); } @@ -4225,10 +4225,10 @@ saop_hash_element_match(struct saophash_hash *tb, Datum key1, Datum key2) void ExecEvalHashedScalarArrayOp(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - ScalarArrayOpExprHashTable *elements_tab = op->d.hashedscalararrayop.elements_tab; - FunctionCallInfo fcinfo = op->d.hashedscalararrayop.fcinfo_data; - bool inclause = op->d.hashedscalararrayop.inclause; - bool strictfunc = op->d.hashedscalararrayop.finfo->fn_strict; + ScalarArrayOpExprHashTable *elements_tab = op->hashedscalararrayop.elements_tab; + FunctionCallInfo fcinfo = op->hashedscalararrayop.fcinfo_data; + bool inclause = op->hashedscalararrayop.inclause; + bool strictfunc = op->hashedscalararrayop.finfo->fn_strict; Datum scalar = fcinfo->args[0].value; bool scalar_isnull = fcinfo->args[0].isnull; Datum result; @@ -4263,7 +4263,7 @@ ExecEvalHashedScalarArrayOp(ExprState *state, ExprEvalStep *op, ExprContext *eco MemoryContext oldcontext; ArrayType *arr; - saop = op->d.hashedscalararrayop.saop; + saop = op->hashedscalararrayop.saop; arr = DatumGetArrayTypeP(*op->resvalue); nitems = ArrayGetNItems(ARR_NDIM(arr), ARR_DIMS(arr)); @@ -4278,7 +4278,7 @@ ExecEvalHashedScalarArrayOp(ExprState *state, ExprEvalStep *op, ExprContext *eco elements_tab = (ScalarArrayOpExprHashTable *) palloc0(offsetof(ScalarArrayOpExprHashTable, hash_fcinfo_data) + SizeForFunctionCallInfo(1)); - op->d.hashedscalararrayop.elements_tab = elements_tab; + op->hashedscalararrayop.elements_tab = elements_tab; elements_tab->op = op; fmgr_info(saop->hashfuncid, &elements_tab->hash_finfo); @@ -4339,7 +4339,7 @@ ExecEvalHashedScalarArrayOp(ExprState *state, ExprEvalStep *op, ExprContext *eco * Remember if we had any nulls so that we know if we need to execute * non-strict functions with a null lhs value if no match is found. */ - op->d.hashedscalararrayop.has_nulls = has_nulls; + op->hashedscalararrayop.has_nulls = has_nulls; } /* Check the hash to see if we have a match. */ @@ -4359,7 +4359,7 @@ ExecEvalHashedScalarArrayOp(ExprState *state, ExprEvalStep *op, ExprContext *eco * hashtable, but instead marked if we found any when building the table * in has_nulls. */ - if (!hashfound && op->d.hashedscalararrayop.has_nulls) + if (!hashfound && op->hashedscalararrayop.has_nulls) { if (strictfunc) { @@ -4385,7 +4385,7 @@ ExecEvalHashedScalarArrayOp(ExprState *state, ExprEvalStep *op, ExprContext *eco fcinfo->args[1].value = (Datum) 0; fcinfo->args[1].isnull = true; - result = op->d.hashedscalararrayop.finfo->fn_addr(fcinfo); + result = op->hashedscalararrayop.finfo->fn_addr(fcinfo); resultnull = fcinfo->isnull; /* @@ -4408,11 +4408,11 @@ void ExecEvalConstraintNotNull(ExprState *state, ExprEvalStep *op) { if (*op->resnull) - errsave((Node *) op->d.domaincheck.escontext, + errsave((Node *) op->domaincheck.escontext, (errcode(ERRCODE_NOT_NULL_VIOLATION), errmsg("domain %s does not allow null values", - format_type_be(op->d.domaincheck.resulttype)), - errdatatype(op->d.domaincheck.resulttype))); + format_type_be(op->domaincheck.resulttype)), + errdatatype(op->domaincheck.resulttype))); } /* @@ -4421,15 +4421,15 @@ ExecEvalConstraintNotNull(ExprState *state, ExprEvalStep *op) void ExecEvalConstraintCheck(ExprState *state, ExprEvalStep *op) { - if (!*op->d.domaincheck.checknull && - !DatumGetBool(*op->d.domaincheck.checkvalue)) - errsave((Node *) op->d.domaincheck.escontext, + if (!*op->domaincheck.checknull && + !DatumGetBool(*op->domaincheck.checkvalue)) + errsave((Node *) op->domaincheck.escontext, (errcode(ERRCODE_CHECK_VIOLATION), errmsg("value for domain %s violates check constraint \"%s\"", - format_type_be(op->d.domaincheck.resulttype), - op->d.domaincheck.constraintname), - errdomainconstraint(op->d.domaincheck.resulttype, - op->d.domaincheck.constraintname))); + format_type_be(op->domaincheck.resulttype), + op->domaincheck.constraintname), + errdomainconstraint(op->domaincheck.resulttype, + op->domaincheck.constraintname))); } /* @@ -4441,7 +4441,7 @@ ExecEvalConstraintCheck(ExprState *state, ExprEvalStep *op) void ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op) { - XmlExpr *xexpr = op->d.xmlexpr.xexpr; + XmlExpr *xexpr = op->xmlexpr.xexpr; Datum value; *op->resnull = true; /* until we get a result */ @@ -4451,8 +4451,8 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op) { case IS_XMLCONCAT: { - Datum *argvalue = op->d.xmlexpr.argvalue; - bool *argnull = op->d.xmlexpr.argnull; + Datum *argvalue = op->xmlexpr.argvalue; + bool *argnull = op->xmlexpr.argnull; List *values = NIL; for (int i = 0; i < list_length(xexpr->args); i++) @@ -4471,8 +4471,8 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op) case IS_XMLFOREST: { - Datum *argvalue = op->d.xmlexpr.named_argvalue; - bool *argnull = op->d.xmlexpr.named_argnull; + Datum *argvalue = op->xmlexpr.named_argvalue; + bool *argnull = op->xmlexpr.named_argnull; StringInfoData buf; ListCell *lc; ListCell *lc2; @@ -4513,17 +4513,17 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op) case IS_XMLELEMENT: *op->resvalue = PointerGetDatum(xmlelement(xexpr, - op->d.xmlexpr.named_argvalue, - op->d.xmlexpr.named_argnull, - op->d.xmlexpr.argvalue, - op->d.xmlexpr.argnull)); + op->xmlexpr.named_argvalue, + op->xmlexpr.named_argnull, + op->xmlexpr.argvalue, + op->xmlexpr.argnull)); *op->resnull = false; break; case IS_XMLPARSE: { - Datum *argvalue = op->d.xmlexpr.argvalue; - bool *argnull = op->d.xmlexpr.argnull; + Datum *argvalue = op->xmlexpr.argvalue; + bool *argnull = op->xmlexpr.argnull; text *data; bool preserve_whitespace; @@ -4557,11 +4557,11 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op) if (xexpr->args) { - isnull = op->d.xmlexpr.argnull[0]; + isnull = op->xmlexpr.argnull[0]; if (isnull) arg = NULL; else - arg = DatumGetTextPP(op->d.xmlexpr.argvalue[0]); + arg = DatumGetTextPP(op->xmlexpr.argvalue[0]); } else { @@ -4578,8 +4578,8 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op) case IS_XMLROOT: { - Datum *argvalue = op->d.xmlexpr.argvalue; - bool *argnull = op->d.xmlexpr.argnull; + Datum *argvalue = op->xmlexpr.argvalue; + bool *argnull = op->xmlexpr.argnull; xmltype *data; text *version; int standalone; @@ -4608,8 +4608,8 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op) case IS_XMLSERIALIZE: { - Datum *argvalue = op->d.xmlexpr.argvalue; - bool *argnull = op->d.xmlexpr.argnull; + Datum *argvalue = op->xmlexpr.argvalue; + bool *argnull = op->xmlexpr.argnull; /* argument type is known to be xml */ Assert(list_length(xexpr->args) == 1); @@ -4628,8 +4628,8 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op) case IS_DOCUMENT: { - Datum *argvalue = op->d.xmlexpr.argvalue; - bool *argnull = op->d.xmlexpr.argnull; + Datum *argvalue = op->xmlexpr.argvalue; + bool *argnull = op->xmlexpr.argnull; /* optional argument is known to be xml */ Assert(list_length(xexpr->args) == 1); @@ -4658,7 +4658,7 @@ ExecEvalJsonConstructor(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { Datum res; - JsonConstructorExprState *jcstate = op->d.json_constructor.jcstate; + JsonConstructorExprState *jcstate = op->json_constructor.jcstate; JsonConstructorExpr *ctor = jcstate->constructor; bool is_jsonb = ctor->returning->format->format_type == JS_FORMAT_JSONB; bool isnull = false; @@ -4734,7 +4734,7 @@ ExecEvalJsonConstructor(ExprState *state, ExprEvalStep *op, void ExecEvalJsonIsPredicate(ExprState *state, ExprEvalStep *op) { - JsonIsPredicate *pred = op->d.is_json.pred; + JsonIsPredicate *pred = op->is_json.pred; Datum js = *op->resvalue; Oid exprtype; bool res; @@ -4818,7 +4818,7 @@ ExecEvalJsonIsPredicate(ExprState *state, ExprEvalStep *op) /* * Evaluate a jsonpath against a document, both of which must have been - * evaluated and their values saved in op->d.jsonexpr.jsestate. + * evaluated and their values saved in op->jsonexpr.jsestate. * * If an error occurs during JsonPath* evaluation or when coercing its result * to the RETURNING type, JsonExprState.error is set to true, provided the @@ -4829,13 +4829,13 @@ ExecEvalJsonIsPredicate(ExprState *state, ExprEvalStep *op) * * Return value is the step address to be performed next. It will be one of * jump_error, jump_empty, jump_eval_coercion, or jump_end, all given in - * op->d.jsonexpr.jsestate. + * op->jsonexpr.jsestate. */ int ExecEvalJsonExprPath(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - JsonExprState *jsestate = op->d.jsonexpr.jsestate; + JsonExprState *jsestate = op->jsonexpr.jsestate; JsonExpr *jsexpr = jsestate->jsexpr; Datum item; JsonPath *path; @@ -5112,7 +5112,7 @@ void ExecEvalJsonCoercion(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - ErrorSaveContext *escontext = op->d.jsonexpr_coercion.escontext; + ErrorSaveContext *escontext = op->jsonexpr_coercion.escontext; /* * Prepare to call json_populate_type() to coerce the boolean result of @@ -5124,15 +5124,15 @@ ExecEvalJsonCoercion(ExprState *state, ExprEvalStep *op, * for integer and domains thereof as it seems common to use those types * for EXISTS columns in JSON_TABLE(). */ - if (op->d.jsonexpr_coercion.exists_coerce) + if (op->jsonexpr_coercion.exists_coerce) { - if (op->d.jsonexpr_coercion.exists_cast_to_int) + if (op->jsonexpr_coercion.exists_cast_to_int) { /* Check domain constraints if any. */ - if (op->d.jsonexpr_coercion.exists_check_domain && + if (op->jsonexpr_coercion.exists_check_domain && !domain_check_safe(*op->resvalue, *op->resnull, - op->d.jsonexpr_coercion.targettype, - &op->d.jsonexpr_coercion.json_coercion_cache, + op->jsonexpr_coercion.targettype, + &op->jsonexpr_coercion.json_coercion_cache, econtext->ecxt_per_query_memory, (Node *) escontext)) { @@ -5151,12 +5151,12 @@ ExecEvalJsonCoercion(ExprState *state, ExprEvalStep *op, } *op->resvalue = json_populate_type(*op->resvalue, JSONBOID, - op->d.jsonexpr_coercion.targettype, - op->d.jsonexpr_coercion.targettypmod, - &op->d.jsonexpr_coercion.json_coercion_cache, + op->jsonexpr_coercion.targettype, + op->jsonexpr_coercion.targettypmod, + &op->jsonexpr_coercion.json_coercion_cache, econtext->ecxt_per_query_memory, op->resnull, - op->d.jsonexpr_coercion.omit_quotes, + op->jsonexpr_coercion.omit_quotes, (Node *) escontext); } @@ -5191,7 +5191,7 @@ GetJsonBehaviorValueString(JsonBehavior *behavior) void ExecEvalJsonCoercionFinish(ExprState *state, ExprEvalStep *op) { - JsonExprState *jsestate = op->d.jsonexpr.jsestate; + JsonExprState *jsestate = op->jsonexpr.jsestate; if (SOFT_ERROR_OCCURRED(&jsestate->escontext)) { @@ -5249,7 +5249,7 @@ ExecEvalGroupingFunc(ExprState *state, ExprEvalStep *op) Bitmapset *grouped_cols = aggstate->grouped_cols; ListCell *lc; - foreach(lc, op->d.grouping_func.clauses) + foreach(lc, op->grouping_func.clauses) { int attnum = lfirst_int(lc); @@ -5308,7 +5308,7 @@ ExecEvalMergeSupportFunc(ExprState *state, ExprEvalStep *op, void ExecEvalSubPlan(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - SubPlanState *sstate = op->d.subplan.sstate; + SubPlanState *sstate = op->subplan.sstate; /* could potentially be nested, so make sure there's enough stack */ check_stack_depth(); @@ -5325,7 +5325,7 @@ ExecEvalSubPlan(ExprState *state, ExprEvalStep *op, ExprContext *econtext) void ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - Var *variable = op->d.wholerow.var; + Var *variable = op->wholerow.var; TupleTableSlot *slot = NULL; TupleDesc output_tupdesc; MemoryContext oldcontext; @@ -5389,8 +5389,8 @@ ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext) } /* Apply the junkfilter if any */ - if (op->d.wholerow.junkFilter != NULL) - slot = ExecFilterJunk(op->d.wholerow.junkFilter, slot); + if (op->wholerow.junkFilter != NULL) + slot = ExecFilterJunk(op->wholerow.junkFilter, slot); /* * If first time through, obtain tuple descriptor and check compatibility. @@ -5399,10 +5399,10 @@ ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext) * initialization phase, but due to using slots that's currently not * feasible. */ - if (op->d.wholerow.first) + if (op->wholerow.first) { /* optimistically assume we don't need slow path */ - op->d.wholerow.slow = false; + op->wholerow.slow = false; /* * If the Var identifies a named composite type, we must check that @@ -5461,7 +5461,7 @@ ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext) if (vattr->attlen != sattr->attlen || vattr->attalign != sattr->attalign) - op->d.wholerow.slow = true; /* need to check for nulls */ + op->wholerow.slow = true; /* need to check for nulls */ } /* @@ -5520,9 +5520,9 @@ ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext) } /* Bless the tupdesc if needed, and save it in the execution state */ - op->d.wholerow.tupdesc = BlessTupleDesc(output_tupdesc); + op->wholerow.tupdesc = BlessTupleDesc(output_tupdesc); - op->d.wholerow.first = false; + op->wholerow.first = false; } /* @@ -5531,11 +5531,11 @@ ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext) */ slot_getallattrs(slot); - if (op->d.wholerow.slow) + if (op->wholerow.slow) { /* Check to see if any dropped attributes are non-null */ TupleDesc tupleDesc = slot->tts_tupleDescriptor; - TupleDesc var_tupdesc = op->d.wholerow.tupdesc; + TupleDesc var_tupdesc = op->wholerow.tupdesc; Assert(var_tupdesc->natts == tupleDesc->natts); @@ -5571,11 +5571,11 @@ ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext) /* * Label the datum with the composite type info we identified before. * - * (Note: we could skip doing this by passing op->d.wholerow.tupdesc to - * the tuple build step; but that seems a tad risky so let's not.) + * (Note: we could skip doing this by passing op->wholerow.tupdesc to the + * tuple build step; but that seems a tad risky so let's not.) */ - HeapTupleHeaderSetTypeId(dtuple, op->d.wholerow.tupdesc->tdtypeid); - HeapTupleHeaderSetTypMod(dtuple, op->d.wholerow.tupdesc->tdtypmod); + HeapTupleHeaderSetTypeId(dtuple, op->wholerow.tupdesc->tdtypeid); + HeapTupleHeaderSetTypMod(dtuple, op->wholerow.tupdesc->tdtypmod); *op->resvalue = PointerGetDatum(dtuple); *op->resnull = false; @@ -5588,9 +5588,9 @@ ExecEvalSysVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext, Datum d; /* OLD/NEW system attribute is NULL if OLD/NEW row is NULL */ - if ((op->d.var.varreturningtype == VAR_RETURNING_OLD && + if ((op->var.varreturningtype == VAR_RETURNING_OLD && state->flags & EEO_FLAG_OLD_IS_NULL) || - (op->d.var.varreturningtype == VAR_RETURNING_NEW && + (op->var.varreturningtype == VAR_RETURNING_NEW && state->flags & EEO_FLAG_NEW_IS_NULL)) { *op->resvalue = (Datum) 0; @@ -5600,7 +5600,7 @@ ExecEvalSysVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext, /* slot_getsysattr has sufficient defenses against bad attnums */ d = slot_getsysattr(slot, - op->d.var.attnum, + op->var.attnum, op->resnull); *op->resvalue = d; /* this ought to be unreachable, but it's cheap enough to check */ @@ -5808,8 +5808,8 @@ void ExecEvalAggOrderedTransDatum(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - AggStatePerTrans pertrans = op->d.agg_trans.pertrans; - int setno = op->d.agg_trans.setno; + AggStatePerTrans pertrans = op->agg_trans.pertrans; + int setno = op->agg_trans.setno; tuplesort_putdatum(pertrans->sortstates[setno], *op->resvalue, *op->resnull); @@ -5822,8 +5822,8 @@ void ExecEvalAggOrderedTransTuple(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - AggStatePerTrans pertrans = op->d.agg_trans.pertrans; - int setno = op->d.agg_trans.setno; + AggStatePerTrans pertrans = op->agg_trans.pertrans; + int setno = op->agg_trans.setno; ExecClearTuple(pertrans->sortslot); pertrans->sortslot->tts_nvalid = pertrans->numInputs; diff --git a/src/backend/utils/adt/arraysubs.c b/src/backend/utils/adt/arraysubs.c index 2940fb8e8d7..ca8f1647c89 100644 --- a/src/backend/utils/adt/arraysubs.c +++ b/src/backend/utils/adt/arraysubs.c @@ -182,7 +182,7 @@ array_subscript_check_subscripts(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - SubscriptingRefState *sbsrefstate = op->d.sbsref_subscript.state; + SubscriptingRefState *sbsrefstate = op->sbsref_subscript.state; ArraySubWorkspace *workspace = (ArraySubWorkspace *) sbsrefstate->workspace; /* Process upper subscripts */ @@ -238,7 +238,7 @@ array_subscript_fetch(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - SubscriptingRefState *sbsrefstate = op->d.sbsref.state; + SubscriptingRefState *sbsrefstate = op->sbsref.state; ArraySubWorkspace *workspace = (ArraySubWorkspace *) sbsrefstate->workspace; /* Should not get here if source array (or any subscript) is null */ @@ -266,7 +266,7 @@ array_subscript_fetch_slice(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - SubscriptingRefState *sbsrefstate = op->d.sbsref.state; + SubscriptingRefState *sbsrefstate = op->sbsref.state; ArraySubWorkspace *workspace = (ArraySubWorkspace *) sbsrefstate->workspace; /* Should not get here if source array (or any subscript) is null */ @@ -296,7 +296,7 @@ array_subscript_assign(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - SubscriptingRefState *sbsrefstate = op->d.sbsref.state; + SubscriptingRefState *sbsrefstate = op->sbsref.state; ArraySubWorkspace *workspace = (ArraySubWorkspace *) sbsrefstate->workspace; Datum arraySource = *op->resvalue; @@ -346,7 +346,7 @@ array_subscript_assign_slice(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - SubscriptingRefState *sbsrefstate = op->d.sbsref.state; + SubscriptingRefState *sbsrefstate = op->sbsref.state; ArraySubWorkspace *workspace = (ArraySubWorkspace *) sbsrefstate->workspace; Datum arraySource = *op->resvalue; @@ -401,7 +401,7 @@ array_subscript_fetch_old(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - SubscriptingRefState *sbsrefstate = op->d.sbsref.state; + SubscriptingRefState *sbsrefstate = op->sbsref.state; ArraySubWorkspace *workspace = (ArraySubWorkspace *) sbsrefstate->workspace; if (*op->resnull) @@ -441,7 +441,7 @@ array_subscript_fetch_old_slice(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - SubscriptingRefState *sbsrefstate = op->d.sbsref.state; + SubscriptingRefState *sbsrefstate = op->sbsref.state; ArraySubWorkspace *workspace = (ArraySubWorkspace *) sbsrefstate->workspace; if (*op->resnull) diff --git a/src/backend/utils/adt/jsonbsubs.c b/src/backend/utils/adt/jsonbsubs.c index e8626d3b4fc..8211de23d59 100644 --- a/src/backend/utils/adt/jsonbsubs.c +++ b/src/backend/utils/adt/jsonbsubs.c @@ -176,7 +176,7 @@ jsonb_subscript_check_subscripts(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - SubscriptingRefState *sbsrefstate = op->d.sbsref_subscript.state; + SubscriptingRefState *sbsrefstate = op->sbsref_subscript.state; JsonbSubWorkspace *workspace = (JsonbSubWorkspace *) sbsrefstate->workspace; /* @@ -236,7 +236,7 @@ jsonb_subscript_fetch(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - SubscriptingRefState *sbsrefstate = op->d.sbsref.state; + SubscriptingRefState *sbsrefstate = op->sbsref.state; JsonbSubWorkspace *workspace = (JsonbSubWorkspace *) sbsrefstate->workspace; Jsonb *jsonbSource; @@ -262,7 +262,7 @@ jsonb_subscript_assign(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - SubscriptingRefState *sbsrefstate = op->d.sbsref.state; + SubscriptingRefState *sbsrefstate = op->sbsref.state; JsonbSubWorkspace *workspace = (JsonbSubWorkspace *) sbsrefstate->workspace; Jsonb *jsonbSource; JsonbValue replacevalue; @@ -324,7 +324,7 @@ jsonb_subscript_fetch_old(ExprState *state, ExprEvalStep *op, ExprContext *econtext) { - SubscriptingRefState *sbsrefstate = op->d.sbsref.state; + SubscriptingRefState *sbsrefstate = op->sbsref.state; if (*op->resnull) { diff --git a/src/include/executor/execExpr.h b/src/include/executor/execExpr.h index 75366203706..3852dcaa5c0 100644 --- a/src/include/executor/execExpr.h +++ b/src/include/executor/execExpr.h @@ -769,7 +769,7 @@ typedef struct ExprEvalStep void *json_coercion_cache; ErrorSaveContext *escontext; } jsonexpr_coercion; - } d; + }; } ExprEvalStep; /* Enforce the size rule given in the comment above */ diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index d19425b7a71..81417f85c99 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -6481,25 +6481,25 @@ plpgsql_param_compile(ParamListInfo params, Param *param, bool isvarlena = (((PLpgSQL_var *) datum)->datatype->typlen == -1); if (isvarlena && dno == expr->target_param && expr->expr_simple_expr) - scratch.d.cparam.paramfunc = plpgsql_param_eval_var_check; + scratch.cparam.paramfunc = plpgsql_param_eval_var_check; else if (isvarlena) - scratch.d.cparam.paramfunc = plpgsql_param_eval_var_ro; + scratch.cparam.paramfunc = plpgsql_param_eval_var_ro; else - scratch.d.cparam.paramfunc = plpgsql_param_eval_var; + scratch.cparam.paramfunc = plpgsql_param_eval_var; } else if (datum->dtype == PLPGSQL_DTYPE_RECFIELD) - scratch.d.cparam.paramfunc = plpgsql_param_eval_recfield; + scratch.cparam.paramfunc = plpgsql_param_eval_recfield; else if (datum->dtype == PLPGSQL_DTYPE_PROMISE) { if (((PLpgSQL_var *) datum)->datatype->typlen == -1) - scratch.d.cparam.paramfunc = plpgsql_param_eval_generic_ro; + scratch.cparam.paramfunc = plpgsql_param_eval_generic_ro; else - scratch.d.cparam.paramfunc = plpgsql_param_eval_generic; + scratch.cparam.paramfunc = plpgsql_param_eval_generic; } else if (datum->dtype == PLPGSQL_DTYPE_REC) - scratch.d.cparam.paramfunc = plpgsql_param_eval_generic_ro; + scratch.cparam.paramfunc = plpgsql_param_eval_generic_ro; else - scratch.d.cparam.paramfunc = plpgsql_param_eval_generic; + scratch.cparam.paramfunc = plpgsql_param_eval_generic; /* * Note: it's tempting to use paramarg to store the estate pointer and @@ -6509,10 +6509,10 @@ plpgsql_param_compile(ParamListInfo params, Param *param, * pointers to the PLpgSQL_expr as well as this specific Param, to support * plpgsql_param_eval_var_check(). */ - scratch.d.cparam.paramarg = expr; - scratch.d.cparam.paramarg2 = param; - scratch.d.cparam.paramid = param->paramid; - scratch.d.cparam.paramtype = param->paramtype; + scratch.cparam.paramarg = expr; + scratch.cparam.paramarg2 = param; + scratch.cparam.paramid = param->paramid; + scratch.cparam.paramtype = param->paramtype; ExprEvalPushStep(state, &scratch); } @@ -6535,7 +6535,7 @@ plpgsql_param_eval_var_check(ExprState *state, ExprEvalStep *op, { ParamListInfo params; PLpgSQL_execstate *estate; - int dno = op->d.cparam.paramid - 1; + int dno = op->cparam.paramid - 1; PLpgSQL_var *var; /* fetch back the hook data */ @@ -6554,15 +6554,15 @@ plpgsql_param_eval_var_check(ExprState *state, ExprEvalStep *op, if (!var->isnull && VARATT_IS_EXTERNAL_EXPANDED_RW(DatumGetPointer(var->value))) { - PLpgSQL_expr *expr = (PLpgSQL_expr *) op->d.cparam.paramarg; - Param *param = (Param *) op->d.cparam.paramarg2; + PLpgSQL_expr *expr = (PLpgSQL_expr *) op->cparam.paramarg; + Param *param = (Param *) op->cparam.paramarg2; /* * We might have already figured this out while evaluating some other * Param referencing the same variable, so check expr_rwopt first. */ if (expr->expr_rwopt == PLPGSQL_RWOPT_UNKNOWN) - exec_check_rw_parameter(expr, op->d.cparam.paramid); + exec_check_rw_parameter(expr, op->cparam.paramid); /* * Update the callback pointer to match what we decided to do, so that @@ -6576,27 +6576,27 @@ plpgsql_param_eval_var_check(ExprState *state, ExprEvalStep *op, break; case PLPGSQL_RWOPT_NOPE: /* Force the value to read-only in all future executions */ - op->d.cparam.paramfunc = plpgsql_param_eval_var_ro; + op->cparam.paramfunc = plpgsql_param_eval_var_ro; plpgsql_param_eval_var_ro(state, op, econtext); break; case PLPGSQL_RWOPT_TRANSFER: /* There can be only one matching Param in this case */ Assert(param == expr->expr_rw_param); /* When the value is read/write, transfer to exec context */ - op->d.cparam.paramfunc = plpgsql_param_eval_var_transfer; + op->cparam.paramfunc = plpgsql_param_eval_var_transfer; plpgsql_param_eval_var_transfer(state, op, econtext); break; case PLPGSQL_RWOPT_INPLACE: if (param == expr->expr_rw_param) { /* When the value is read/write, deliver it as-is */ - op->d.cparam.paramfunc = plpgsql_param_eval_var; + op->cparam.paramfunc = plpgsql_param_eval_var; plpgsql_param_eval_var(state, op, econtext); } else { /* Not the optimizable reference, so force to read-only */ - op->d.cparam.paramfunc = plpgsql_param_eval_var_ro; + op->cparam.paramfunc = plpgsql_param_eval_var_ro; plpgsql_param_eval_var_ro(state, op, econtext); } break; @@ -6613,7 +6613,7 @@ plpgsql_param_eval_var_check(ExprState *state, ExprEvalStep *op, *op->resnull = var->isnull; /* safety check -- an assertion should be sufficient */ - Assert(var->datatype->typoid == op->d.cparam.paramtype); + Assert(var->datatype->typoid == op->cparam.paramtype); } /* @@ -6632,7 +6632,7 @@ plpgsql_param_eval_var_transfer(ExprState *state, ExprEvalStep *op, { ParamListInfo params; PLpgSQL_execstate *estate; - int dno = op->d.cparam.paramid - 1; + int dno = op->cparam.paramid - 1; PLpgSQL_var *var; /* fetch back the hook data */ @@ -6673,7 +6673,7 @@ plpgsql_param_eval_var_transfer(ExprState *state, ExprEvalStep *op, } /* safety check -- an assertion should be sufficient */ - Assert(var->datatype->typoid == op->d.cparam.paramtype); + Assert(var->datatype->typoid == op->cparam.paramtype); } /* @@ -6688,7 +6688,7 @@ plpgsql_param_eval_var(ExprState *state, ExprEvalStep *op, { ParamListInfo params; PLpgSQL_execstate *estate; - int dno = op->d.cparam.paramid - 1; + int dno = op->cparam.paramid - 1; PLpgSQL_var *var; /* fetch back the hook data */ @@ -6705,7 +6705,7 @@ plpgsql_param_eval_var(ExprState *state, ExprEvalStep *op, *op->resnull = var->isnull; /* safety check -- an assertion should be sufficient */ - Assert(var->datatype->typoid == op->d.cparam.paramtype); + Assert(var->datatype->typoid == op->cparam.paramtype); } /* @@ -6720,7 +6720,7 @@ plpgsql_param_eval_var_ro(ExprState *state, ExprEvalStep *op, { ParamListInfo params; PLpgSQL_execstate *estate; - int dno = op->d.cparam.paramid - 1; + int dno = op->cparam.paramid - 1; PLpgSQL_var *var; /* fetch back the hook data */ @@ -6742,7 +6742,7 @@ plpgsql_param_eval_var_ro(ExprState *state, ExprEvalStep *op, *op->resnull = var->isnull; /* safety check -- an assertion should be sufficient */ - Assert(var->datatype->typoid == op->d.cparam.paramtype); + Assert(var->datatype->typoid == op->cparam.paramtype); } /* @@ -6757,7 +6757,7 @@ plpgsql_param_eval_recfield(ExprState *state, ExprEvalStep *op, { ParamListInfo params; PLpgSQL_execstate *estate; - int dno = op->d.cparam.paramid - 1; + int dno = op->cparam.paramid - 1; PLpgSQL_recfield *recfield; PLpgSQL_rec *rec; ExpandedRecordHeader *erh; @@ -6808,13 +6808,13 @@ plpgsql_param_eval_recfield(ExprState *state, ExprEvalStep *op, op->resnull); /* safety check -- needed for, eg, record fields */ - if (unlikely(recfield->finfo.ftypeid != op->d.cparam.paramtype)) + if (unlikely(recfield->finfo.ftypeid != op->cparam.paramtype)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("type of parameter %d (%s) does not match that when preparing the plan (%s)", - op->d.cparam.paramid, + op->cparam.paramid, format_type_be(recfield->finfo.ftypeid), - format_type_be(op->d.cparam.paramtype)))); + format_type_be(op->cparam.paramtype)))); } /* @@ -6829,7 +6829,7 @@ plpgsql_param_eval_generic(ExprState *state, ExprEvalStep *op, { ParamListInfo params; PLpgSQL_execstate *estate; - int dno = op->d.cparam.paramid - 1; + int dno = op->cparam.paramid - 1; PLpgSQL_datum *datum; Oid datumtype; int32 datumtypmod; @@ -6848,13 +6848,13 @@ plpgsql_param_eval_generic(ExprState *state, ExprEvalStep *op, op->resvalue, op->resnull); /* safety check -- needed for, eg, record fields */ - if (unlikely(datumtype != op->d.cparam.paramtype)) + if (unlikely(datumtype != op->cparam.paramtype)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("type of parameter %d (%s) does not match that when preparing the plan (%s)", - op->d.cparam.paramid, + op->cparam.paramid, format_type_be(datumtype), - format_type_be(op->d.cparam.paramtype)))); + format_type_be(op->cparam.paramtype)))); } /* @@ -6869,7 +6869,7 @@ plpgsql_param_eval_generic_ro(ExprState *state, ExprEvalStep *op, { ParamListInfo params; PLpgSQL_execstate *estate; - int dno = op->d.cparam.paramid - 1; + int dno = op->cparam.paramid - 1; PLpgSQL_datum *datum; Oid datumtype; int32 datumtypmod; @@ -6888,13 +6888,13 @@ plpgsql_param_eval_generic_ro(ExprState *state, ExprEvalStep *op, op->resvalue, op->resnull); /* safety check -- needed for, eg, record fields */ - if (unlikely(datumtype != op->d.cparam.paramtype)) + if (unlikely(datumtype != op->cparam.paramtype)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("type of parameter %d (%s) does not match that when preparing the plan (%s)", - op->d.cparam.paramid, + op->cparam.paramid, format_type_be(datumtype), - format_type_be(op->d.cparam.paramtype)))); + format_type_be(op->cparam.paramtype)))); /* force the value to read-only */ *op->resvalue = MakeExpandedObjectReadOnly(*op->resvalue, -- 2.51.0