PostgreSQL Source Code  git master
nodeModifyTable.h File Reference
#include "nodes/execnodes.h"
Include dependency graph for nodeModifyTable.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void ExecInitStoredGenerated (ResultRelInfo *resultRelInfo, EState *estate, CmdType cmdtype)
 
void ExecComputeStoredGenerated (ResultRelInfo *resultRelInfo, EState *estate, TupleTableSlot *slot, CmdType cmdtype)
 
ModifyTableStateExecInitModifyTable (ModifyTable *node, EState *estate, int eflags)
 
void ExecEndModifyTable (ModifyTableState *node)
 
void ExecReScanModifyTable (ModifyTableState *node)
 
void ExecInitMergeTupleSlots (ModifyTableState *mtstate, ResultRelInfo *resultRelInfo)
 

Function Documentation

◆ ExecComputeStoredGenerated()

void ExecComputeStoredGenerated ( ResultRelInfo resultRelInfo,
EState estate,
TupleTableSlot slot,
CmdType  cmdtype 
)

Definition at line 452 of file nodeModifyTable.c.

455 {
456  Relation rel = resultRelInfo->ri_RelationDesc;
457  TupleDesc tupdesc = RelationGetDescr(rel);
458  int natts = tupdesc->natts;
459  ExprContext *econtext = GetPerTupleExprContext(estate);
460  ExprState **ri_GeneratedExprs;
461  MemoryContext oldContext;
462  Datum *values;
463  bool *nulls;
464 
465  /* We should not be called unless this is true */
466  Assert(tupdesc->constr && tupdesc->constr->has_generated_stored);
467 
468  /*
469  * Initialize the expressions if we didn't already, and check whether we
470  * can exit early because nothing needs to be computed.
471  */
472  if (cmdtype == CMD_UPDATE)
473  {
474  if (resultRelInfo->ri_GeneratedExprsU == NULL)
475  ExecInitStoredGenerated(resultRelInfo, estate, cmdtype);
476  if (resultRelInfo->ri_NumGeneratedNeededU == 0)
477  return;
478  ri_GeneratedExprs = resultRelInfo->ri_GeneratedExprsU;
479  }
480  else
481  {
482  if (resultRelInfo->ri_GeneratedExprsI == NULL)
483  ExecInitStoredGenerated(resultRelInfo, estate, cmdtype);
484  /* Early exit is impossible given the prior Assert */
485  Assert(resultRelInfo->ri_NumGeneratedNeededI > 0);
486  ri_GeneratedExprs = resultRelInfo->ri_GeneratedExprsI;
487  }
488 
489  oldContext = MemoryContextSwitchTo(GetPerTupleMemoryContext(estate));
490 
491  values = palloc(sizeof(*values) * natts);
492  nulls = palloc(sizeof(*nulls) * natts);
493 
494  slot_getallattrs(slot);
495  memcpy(nulls, slot->tts_isnull, sizeof(*nulls) * natts);
496 
497  for (int i = 0; i < natts; i++)
498  {
499  Form_pg_attribute attr = TupleDescAttr(tupdesc, i);
500 
501  if (ri_GeneratedExprs[i])
502  {
503  Datum val;
504  bool isnull;
505 
506  Assert(attr->attgenerated == ATTRIBUTE_GENERATED_STORED);
507 
508  econtext->ecxt_scantuple = slot;
509 
510  val = ExecEvalExpr(ri_GeneratedExprs[i], econtext, &isnull);
511 
512  /*
513  * We must make a copy of val as we have no guarantees about where
514  * memory for a pass-by-reference Datum is located.
515  */
516  if (!isnull)
517  val = datumCopy(val, attr->attbyval, attr->attlen);
518 
519  values[i] = val;
520  nulls[i] = isnull;
521  }
522  else
523  {
524  if (!nulls[i])
525  values[i] = datumCopy(slot->tts_values[i], attr->attbyval, attr->attlen);
526  }
527  }
528 
529  ExecClearTuple(slot);
530  memcpy(slot->tts_values, values, sizeof(*values) * natts);
531  memcpy(slot->tts_isnull, nulls, sizeof(*nulls) * natts);
532  ExecStoreVirtualTuple(slot);
533  ExecMaterializeSlot(slot);
534 
535  MemoryContextSwitchTo(oldContext);
536 }
static Datum values[MAXATTR]
Definition: bootstrap.c:150
#define Assert(condition)
Definition: c.h:858
Datum datumCopy(Datum value, bool typByVal, int typLen)
Definition: datum.c:132
TupleTableSlot * ExecStoreVirtualTuple(TupleTableSlot *slot)
Definition: execTuples.c:1639
#define GetPerTupleExprContext(estate)
Definition: executor.h:550
#define GetPerTupleMemoryContext(estate)
Definition: executor.h:555
static Datum ExecEvalExpr(ExprState *state, ExprContext *econtext, bool *isNull)
Definition: executor.h:333
long val
Definition: informix.c:670
int i
Definition: isn.c:73
void * palloc(Size size)
Definition: mcxt.c:1317
void ExecInitStoredGenerated(ResultRelInfo *resultRelInfo, EState *estate, CmdType cmdtype)
@ CMD_UPDATE
Definition: nodes.h:266
FormData_pg_attribute * Form_pg_attribute
Definition: pg_attribute.h:209
uintptr_t Datum
Definition: postgres.h:64
MemoryContextSwitchTo(old_ctx)
#define RelationGetDescr(relation)
Definition: rel.h:531
TupleTableSlot * ecxt_scantuple
Definition: execnodes.h:255
Relation ri_RelationDesc
Definition: execnodes.h:456
ExprState ** ri_GeneratedExprsI
Definition: execnodes.h:528
int ri_NumGeneratedNeededU
Definition: execnodes.h:533
ExprState ** ri_GeneratedExprsU
Definition: execnodes.h:529
int ri_NumGeneratedNeededI
Definition: execnodes.h:532
bool has_generated_stored
Definition: tupdesc.h:45
TupleConstr * constr
Definition: tupdesc.h:85
bool * tts_isnull
Definition: tuptable.h:127
Datum * tts_values
Definition: tuptable.h:125
#define TupleDescAttr(tupdesc, i)
Definition: tupdesc.h:92
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: tuptable.h:454
static void slot_getallattrs(TupleTableSlot *slot)
Definition: tuptable.h:368
static void ExecMaterializeSlot(TupleTableSlot *slot)
Definition: tuptable.h:472

References Assert, CMD_UPDATE, TupleDescData::constr, datumCopy(), ExprContext::ecxt_scantuple, ExecClearTuple(), ExecEvalExpr(), ExecInitStoredGenerated(), ExecMaterializeSlot(), ExecStoreVirtualTuple(), GetPerTupleExprContext, GetPerTupleMemoryContext, TupleConstr::has_generated_stored, i, MemoryContextSwitchTo(), TupleDescData::natts, palloc(), RelationGetDescr, ResultRelInfo::ri_GeneratedExprsI, ResultRelInfo::ri_GeneratedExprsU, ResultRelInfo::ri_NumGeneratedNeededI, ResultRelInfo::ri_NumGeneratedNeededU, ResultRelInfo::ri_RelationDesc, slot_getallattrs(), TupleTableSlot::tts_isnull, TupleTableSlot::tts_values, TupleDescAttr, val, and values.

Referenced by CopyFrom(), ExecInsert(), ExecSimpleRelationInsert(), ExecSimpleRelationUpdate(), and ExecUpdatePrepareSlot().

◆ ExecEndModifyTable()

void ExecEndModifyTable ( ModifyTableState node)

Definition at line 4698 of file nodeModifyTable.c.

4699 {
4700  int i;
4701 
4702  /*
4703  * Allow any FDWs to shut down
4704  */
4705  for (i = 0; i < node->mt_nrels; i++)
4706  {
4707  int j;
4708  ResultRelInfo *resultRelInfo = node->resultRelInfo + i;
4709 
4710  if (!resultRelInfo->ri_usesFdwDirectModify &&
4711  resultRelInfo->ri_FdwRoutine != NULL &&
4712  resultRelInfo->ri_FdwRoutine->EndForeignModify != NULL)
4713  resultRelInfo->ri_FdwRoutine->EndForeignModify(node->ps.state,
4714  resultRelInfo);
4715 
4716  /*
4717  * Cleanup the initialized batch slots. This only matters for FDWs
4718  * with batching, but the other cases will have ri_NumSlotsInitialized
4719  * == 0.
4720  */
4721  for (j = 0; j < resultRelInfo->ri_NumSlotsInitialized; j++)
4722  {
4723  ExecDropSingleTupleTableSlot(resultRelInfo->ri_Slots[j]);
4724  ExecDropSingleTupleTableSlot(resultRelInfo->ri_PlanSlots[j]);
4725  }
4726  }
4727 
4728  /*
4729  * Close all the partitioned tables, leaf partitions, and their indices
4730  * and release the slot used for tuple routing, if set.
4731  */
4732  if (node->mt_partition_tuple_routing)
4733  {
4735 
4736  if (node->mt_root_tuple_slot)
4738  }
4739 
4740  /*
4741  * Terminate EPQ execution if active
4742  */
4743  EvalPlanQualEnd(&node->mt_epqstate);
4744 
4745  /*
4746  * shut down subplan
4747  */
4748  ExecEndNode(outerPlanState(node));
4749 }
void EvalPlanQualEnd(EPQState *epqstate)
Definition: execMain.c:2982
void ExecCleanupTupleRouting(ModifyTableState *mtstate, PartitionTupleRouting *proute)
void ExecEndNode(PlanState *node)
Definition: execProcnode.c:557
void ExecDropSingleTupleTableSlot(TupleTableSlot *slot)
Definition: execTuples.c:1341
#define outerPlanState(node)
Definition: execnodes.h:1212
int j
Definition: isn.c:74
EndForeignModify_function EndForeignModify
Definition: fdwapi.h:237
ResultRelInfo * resultRelInfo
Definition: execnodes.h:1359
struct PartitionTupleRouting * mt_partition_tuple_routing
Definition: execnodes.h:1390
TupleTableSlot * mt_root_tuple_slot
Definition: execnodes.h:1387
EPQState mt_epqstate
Definition: execnodes.h:1369
PlanState ps
Definition: execnodes.h:1354
EState * state
Definition: execnodes.h:1118
TupleTableSlot ** ri_Slots
Definition: execnodes.h:515
int ri_NumSlotsInitialized
Definition: execnodes.h:513
struct FdwRoutine * ri_FdwRoutine
Definition: execnodes.h:503
TupleTableSlot ** ri_PlanSlots
Definition: execnodes.h:516
bool ri_usesFdwDirectModify
Definition: execnodes.h:509

References FdwRoutine::EndForeignModify, EvalPlanQualEnd(), ExecCleanupTupleRouting(), ExecDropSingleTupleTableSlot(), ExecEndNode(), i, j, ModifyTableState::mt_epqstate, ModifyTableState::mt_nrels, ModifyTableState::mt_partition_tuple_routing, ModifyTableState::mt_root_tuple_slot, outerPlanState, ModifyTableState::ps, ModifyTableState::resultRelInfo, ResultRelInfo::ri_FdwRoutine, ResultRelInfo::ri_NumSlotsInitialized, ResultRelInfo::ri_PlanSlots, ResultRelInfo::ri_Slots, ResultRelInfo::ri_usesFdwDirectModify, and PlanState::state.

Referenced by ExecEndNode().

◆ ExecInitMergeTupleSlots()

void ExecInitMergeTupleSlots ( ModifyTableState mtstate,
ResultRelInfo resultRelInfo 
)

Definition at line 3565 of file nodeModifyTable.c.

3567 {
3568  EState *estate = mtstate->ps.state;
3569 
3570  Assert(!resultRelInfo->ri_projectNewInfoValid);
3571 
3572  resultRelInfo->ri_oldTupleSlot =
3573  table_slot_create(resultRelInfo->ri_RelationDesc,
3574  &estate->es_tupleTable);
3575  resultRelInfo->ri_newTupleSlot =
3576  table_slot_create(resultRelInfo->ri_RelationDesc,
3577  &estate->es_tupleTable);
3578  resultRelInfo->ri_projectNewInfoValid = true;
3579 }
List * es_tupleTable
Definition: execnodes.h:669
bool ri_projectNewInfoValid
Definition: execnodes.h:483
TupleTableSlot * ri_oldTupleSlot
Definition: execnodes.h:481
TupleTableSlot * ri_newTupleSlot
Definition: execnodes.h:479
TupleTableSlot * table_slot_create(Relation relation, List **reglist)
Definition: tableam.c:91

References Assert, EState::es_tupleTable, ModifyTableState::ps, ResultRelInfo::ri_newTupleSlot, ResultRelInfo::ri_oldTupleSlot, ResultRelInfo::ri_projectNewInfoValid, ResultRelInfo::ri_RelationDesc, PlanState::state, and table_slot_create().

Referenced by ExecInitMerge(), and ExecInitPartitionInfo().

◆ ExecInitModifyTable()

ModifyTableState* ExecInitModifyTable ( ModifyTable node,
EState estate,
int  eflags 
)

Definition at line 4213 of file nodeModifyTable.c.

4214 {
4215  ModifyTableState *mtstate;
4216  Plan *subplan = outerPlan(node);
4217  CmdType operation = node->operation;
4218  int nrels = list_length(node->resultRelations);
4219  ResultRelInfo *resultRelInfo;
4220  List *arowmarks;
4221  ListCell *l;
4222  int i;
4223  Relation rel;
4224 
4225  /* check for unsupported flags */
4226  Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
4227 
4228  /*
4229  * create state structure
4230  */
4231  mtstate = makeNode(ModifyTableState);
4232  mtstate->ps.plan = (Plan *) node;
4233  mtstate->ps.state = estate;
4234  mtstate->ps.ExecProcNode = ExecModifyTable;
4235 
4236  mtstate->operation = operation;
4237  mtstate->canSetTag = node->canSetTag;
4238  mtstate->mt_done = false;
4239 
4240  mtstate->mt_nrels = nrels;
4241  mtstate->resultRelInfo = (ResultRelInfo *)
4242  palloc(nrels * sizeof(ResultRelInfo));
4243 
4244  mtstate->mt_merge_pending_not_matched = NULL;
4245  mtstate->mt_merge_inserted = 0;
4246  mtstate->mt_merge_updated = 0;
4247  mtstate->mt_merge_deleted = 0;
4248 
4249  /*----------
4250  * Resolve the target relation. This is the same as:
4251  *
4252  * - the relation for which we will fire FOR STATEMENT triggers,
4253  * - the relation into whose tuple format all captured transition tuples
4254  * must be converted, and
4255  * - the root partitioned table used for tuple routing.
4256  *
4257  * If it's a partitioned or inherited table, the root partition or
4258  * appendrel RTE doesn't appear elsewhere in the plan and its RT index is
4259  * given explicitly in node->rootRelation. Otherwise, the target relation
4260  * is the sole relation in the node->resultRelations list.
4261  *----------
4262  */
4263  if (node->rootRelation > 0)
4264  {
4266  ExecInitResultRelation(estate, mtstate->rootResultRelInfo,
4267  node->rootRelation);
4268  }
4269  else
4270  {
4271  Assert(list_length(node->resultRelations) == 1);
4272  mtstate->rootResultRelInfo = mtstate->resultRelInfo;
4273  ExecInitResultRelation(estate, mtstate->resultRelInfo,
4274  linitial_int(node->resultRelations));
4275  }
4276 
4277  /* set up epqstate with dummy subplan data for the moment */
4278  EvalPlanQualInit(&mtstate->mt_epqstate, estate, NULL, NIL,
4279  node->epqParam, node->resultRelations);
4280  mtstate->fireBSTriggers = true;
4281 
4282  /*
4283  * Build state for collecting transition tuples. This requires having a
4284  * valid trigger query context, so skip it in explain-only mode.
4285  */
4286  if (!(eflags & EXEC_FLAG_EXPLAIN_ONLY))
4287  ExecSetupTransitionCaptureState(mtstate, estate);
4288 
4289  /*
4290  * Open all the result relations and initialize the ResultRelInfo structs.
4291  * (But root relation was initialized above, if it's part of the array.)
4292  * We must do this before initializing the subplan, because direct-modify
4293  * FDWs expect their ResultRelInfos to be available.
4294  */
4295  resultRelInfo = mtstate->resultRelInfo;
4296  i = 0;
4297  foreach(l, node->resultRelations)
4298  {
4299  Index resultRelation = lfirst_int(l);
4300  List *mergeActions = NIL;
4301 
4302  if (node->mergeActionLists)
4303  mergeActions = list_nth(node->mergeActionLists, i);
4304 
4305  if (resultRelInfo != mtstate->rootResultRelInfo)
4306  {
4307  ExecInitResultRelation(estate, resultRelInfo, resultRelation);
4308 
4309  /*
4310  * For child result relations, store the root result relation
4311  * pointer. We do so for the convenience of places that want to
4312  * look at the query's original target relation but don't have the
4313  * mtstate handy.
4314  */
4315  resultRelInfo->ri_RootResultRelInfo = mtstate->rootResultRelInfo;
4316  }
4317 
4318  /* Initialize the usesFdwDirectModify flag */
4319  resultRelInfo->ri_usesFdwDirectModify =
4321 
4322  /*
4323  * Verify result relation is a valid target for the current operation
4324  */
4325  CheckValidResultRel(resultRelInfo, operation, mergeActions);
4326 
4327  resultRelInfo++;
4328  i++;
4329  }
4330 
4331  /*
4332  * Now we may initialize the subplan.
4333  */
4334  outerPlanState(mtstate) = ExecInitNode(subplan, estate, eflags);
4335 
4336  /*
4337  * Do additional per-result-relation initialization.
4338  */
4339  for (i = 0; i < nrels; i++)
4340  {
4341  resultRelInfo = &mtstate->resultRelInfo[i];
4342 
4343  /* Let FDWs init themselves for foreign-table result rels */
4344  if (!resultRelInfo->ri_usesFdwDirectModify &&
4345  resultRelInfo->ri_FdwRoutine != NULL &&
4346  resultRelInfo->ri_FdwRoutine->BeginForeignModify != NULL)
4347  {
4348  List *fdw_private = (List *) list_nth(node->fdwPrivLists, i);
4349 
4350  resultRelInfo->ri_FdwRoutine->BeginForeignModify(mtstate,
4351  resultRelInfo,
4352  fdw_private,
4353  i,
4354  eflags);
4355  }
4356 
4357  /*
4358  * For UPDATE/DELETE/MERGE, find the appropriate junk attr now, either
4359  * a 'ctid' or 'wholerow' attribute depending on relkind. For foreign
4360  * tables, the FDW might have created additional junk attr(s), but
4361  * those are no concern of ours.
4362  */
4363  if (operation == CMD_UPDATE || operation == CMD_DELETE ||
4364  operation == CMD_MERGE)
4365  {
4366  char relkind;
4367 
4368  relkind = resultRelInfo->ri_RelationDesc->rd_rel->relkind;
4369  if (relkind == RELKIND_RELATION ||
4370  relkind == RELKIND_MATVIEW ||
4371  relkind == RELKIND_PARTITIONED_TABLE)
4372  {
4373  resultRelInfo->ri_RowIdAttNo =
4374  ExecFindJunkAttributeInTlist(subplan->targetlist, "ctid");
4375  if (!AttributeNumberIsValid(resultRelInfo->ri_RowIdAttNo))
4376  elog(ERROR, "could not find junk ctid column");
4377  }
4378  else if (relkind == RELKIND_FOREIGN_TABLE)
4379  {
4380  /*
4381  * We don't support MERGE with foreign tables for now. (It's
4382  * problematic because the implementation uses CTID.)
4383  */
4384  Assert(operation != CMD_MERGE);
4385 
4386  /*
4387  * When there is a row-level trigger, there should be a
4388  * wholerow attribute. We also require it to be present in
4389  * UPDATE and MERGE, so we can get the values of unchanged
4390  * columns.
4391  */
4392  resultRelInfo->ri_RowIdAttNo =
4394  "wholerow");
4395  if ((mtstate->operation == CMD_UPDATE || mtstate->operation == CMD_MERGE) &&
4396  !AttributeNumberIsValid(resultRelInfo->ri_RowIdAttNo))
4397  elog(ERROR, "could not find junk wholerow column");
4398  }
4399  else
4400  {
4401  /* Other valid target relkinds must provide wholerow */
4402  resultRelInfo->ri_RowIdAttNo =
4404  "wholerow");
4405  if (!AttributeNumberIsValid(resultRelInfo->ri_RowIdAttNo))
4406  elog(ERROR, "could not find junk wholerow column");
4407  }
4408  }
4409  }
4410 
4411  /*
4412  * If this is an inherited update/delete/merge, there will be a junk
4413  * attribute named "tableoid" present in the subplan's targetlist. It
4414  * will be used to identify the result relation for a given tuple to be
4415  * updated/deleted/merged.
4416  */
4417  mtstate->mt_resultOidAttno =
4418  ExecFindJunkAttributeInTlist(subplan->targetlist, "tableoid");
4419  Assert(AttributeNumberIsValid(mtstate->mt_resultOidAttno) || nrels == 1);
4420  mtstate->mt_lastResultOid = InvalidOid; /* force lookup at first tuple */
4421  mtstate->mt_lastResultIndex = 0; /* must be zero if no such attr */
4422 
4423  /* Get the root target relation */
4424  rel = mtstate->rootResultRelInfo->ri_RelationDesc;
4425 
4426  /*
4427  * Build state for tuple routing if it's a partitioned INSERT. An UPDATE
4428  * or MERGE might need this too, but only if it actually moves tuples
4429  * between partitions; in that case setup is done by
4430  * ExecCrossPartitionUpdate.
4431  */
4432  if (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE &&
4433  operation == CMD_INSERT)
4434  mtstate->mt_partition_tuple_routing =
4435  ExecSetupPartitionTupleRouting(estate, rel);
4436 
4437  /*
4438  * Initialize any WITH CHECK OPTION constraints if needed.
4439  */
4440  resultRelInfo = mtstate->resultRelInfo;
4441  foreach(l, node->withCheckOptionLists)
4442  {
4443  List *wcoList = (List *) lfirst(l);
4444  List *wcoExprs = NIL;
4445  ListCell *ll;
4446 
4447  foreach(ll, wcoList)
4448  {
4449  WithCheckOption *wco = (WithCheckOption *) lfirst(ll);
4450  ExprState *wcoExpr = ExecInitQual((List *) wco->qual,
4451  &mtstate->ps);
4452 
4453  wcoExprs = lappend(wcoExprs, wcoExpr);
4454  }
4455 
4456  resultRelInfo->ri_WithCheckOptions = wcoList;
4457  resultRelInfo->ri_WithCheckOptionExprs = wcoExprs;
4458  resultRelInfo++;
4459  }
4460 
4461  /*
4462  * Initialize RETURNING projections if needed.
4463  */
4464  if (node->returningLists)
4465  {
4466  TupleTableSlot *slot;
4467  ExprContext *econtext;
4468 
4469  /*
4470  * Initialize result tuple slot and assign its rowtype using the first
4471  * RETURNING list. We assume the rest will look the same.
4472  */
4473  mtstate->ps.plan->targetlist = (List *) linitial(node->returningLists);
4474 
4475  /* Set up a slot for the output of the RETURNING projection(s) */
4477  slot = mtstate->ps.ps_ResultTupleSlot;
4478 
4479  /* Need an econtext too */
4480  if (mtstate->ps.ps_ExprContext == NULL)
4481  ExecAssignExprContext(estate, &mtstate->ps);
4482  econtext = mtstate->ps.ps_ExprContext;
4483 
4484  /*
4485  * Build a projection for each result rel.
4486  */
4487  resultRelInfo = mtstate->resultRelInfo;
4488  foreach(l, node->returningLists)
4489  {
4490  List *rlist = (List *) lfirst(l);
4491 
4492  resultRelInfo->ri_returningList = rlist;
4493  resultRelInfo->ri_projectReturning =
4494  ExecBuildProjectionInfo(rlist, econtext, slot, &mtstate->ps,
4495  resultRelInfo->ri_RelationDesc->rd_att);
4496  resultRelInfo++;
4497  }
4498  }
4499  else
4500  {
4501  /*
4502  * We still must construct a dummy result tuple type, because InitPlan
4503  * expects one (maybe should change that?).
4504  */
4505  mtstate->ps.plan->targetlist = NIL;
4506  ExecInitResultTypeTL(&mtstate->ps);
4507 
4508  mtstate->ps.ps_ExprContext = NULL;
4509  }
4510 
4511  /* Set the list of arbiter indexes if needed for ON CONFLICT */
4512  resultRelInfo = mtstate->resultRelInfo;
4513  if (node->onConflictAction != ONCONFLICT_NONE)
4514  {
4515  /* insert may only have one relation, inheritance is not expanded */
4516  Assert(nrels == 1);
4517  resultRelInfo->ri_onConflictArbiterIndexes = node->arbiterIndexes;
4518  }
4519 
4520  /*
4521  * If needed, Initialize target list, projection and qual for ON CONFLICT
4522  * DO UPDATE.
4523  */
4524  if (node->onConflictAction == ONCONFLICT_UPDATE)
4525  {
4527  ExprContext *econtext;
4528  TupleDesc relationDesc;
4529 
4530  /* already exists if created by RETURNING processing above */
4531  if (mtstate->ps.ps_ExprContext == NULL)
4532  ExecAssignExprContext(estate, &mtstate->ps);
4533 
4534  econtext = mtstate->ps.ps_ExprContext;
4535  relationDesc = resultRelInfo->ri_RelationDesc->rd_att;
4536 
4537  /* create state for DO UPDATE SET operation */
4538  resultRelInfo->ri_onConflict = onconfl;
4539 
4540  /* initialize slot for the existing tuple */
4541  onconfl->oc_Existing =
4542  table_slot_create(resultRelInfo->ri_RelationDesc,
4543  &mtstate->ps.state->es_tupleTable);
4544 
4545  /*
4546  * Create the tuple slot for the UPDATE SET projection. We want a slot
4547  * of the table's type here, because the slot will be used to insert
4548  * into the table, and for RETURNING processing - which may access
4549  * system attributes.
4550  */
4551  onconfl->oc_ProjSlot =
4552  table_slot_create(resultRelInfo->ri_RelationDesc,
4553  &mtstate->ps.state->es_tupleTable);
4554 
4555  /* build UPDATE SET projection state */
4556  onconfl->oc_ProjInfo =
4558  true,
4559  node->onConflictCols,
4560  relationDesc,
4561  econtext,
4562  onconfl->oc_ProjSlot,
4563  &mtstate->ps);
4564 
4565  /* initialize state to evaluate the WHERE clause, if any */
4566  if (node->onConflictWhere)
4567  {
4568  ExprState *qualexpr;
4569 
4570  qualexpr = ExecInitQual((List *) node->onConflictWhere,
4571  &mtstate->ps);
4572  onconfl->oc_WhereClause = qualexpr;
4573  }
4574  }
4575 
4576  /*
4577  * If we have any secondary relations in an UPDATE or DELETE, they need to
4578  * be treated like non-locked relations in SELECT FOR UPDATE, i.e., the
4579  * EvalPlanQual mechanism needs to be told about them. This also goes for
4580  * the source relations in a MERGE. Locate the relevant ExecRowMarks.
4581  */
4582  arowmarks = NIL;
4583  foreach(l, node->rowMarks)
4584  {
4586  ExecRowMark *erm;
4587  ExecAuxRowMark *aerm;
4588 
4589  /* ignore "parent" rowmarks; they are irrelevant at runtime */
4590  if (rc->isParent)
4591  continue;
4592 
4593  /* Find ExecRowMark and build ExecAuxRowMark */
4594  erm = ExecFindRowMark(estate, rc->rti, false);
4595  aerm = ExecBuildAuxRowMark(erm, subplan->targetlist);
4596  arowmarks = lappend(arowmarks, aerm);
4597  }
4598 
4599  /* For a MERGE command, initialize its state */
4600  if (mtstate->operation == CMD_MERGE)
4601  ExecInitMerge(mtstate, estate);
4602 
4603  EvalPlanQualSetPlan(&mtstate->mt_epqstate, subplan, arowmarks);
4604 
4605  /*
4606  * If there are a lot of result relations, use a hash table to speed the
4607  * lookups. If there are not a lot, a simple linear search is faster.
4608  *
4609  * It's not clear where the threshold is, but try 64 for starters. In a
4610  * debugging build, use a small threshold so that we get some test
4611  * coverage of both code paths.
4612  */
4613 #ifdef USE_ASSERT_CHECKING
4614 #define MT_NRELS_HASH 4
4615 #else
4616 #define MT_NRELS_HASH 64
4617 #endif
4618  if (nrels >= MT_NRELS_HASH)
4619  {
4620  HASHCTL hash_ctl;
4621 
4622  hash_ctl.keysize = sizeof(Oid);
4623  hash_ctl.entrysize = sizeof(MTTargetRelLookup);
4624  hash_ctl.hcxt = CurrentMemoryContext;
4625  mtstate->mt_resultOidHash =
4626  hash_create("ModifyTable target hash",
4627  nrels, &hash_ctl,
4629  for (i = 0; i < nrels; i++)
4630  {
4631  Oid hashkey;
4632  MTTargetRelLookup *mtlookup;
4633  bool found;
4634 
4635  resultRelInfo = &mtstate->resultRelInfo[i];
4636  hashkey = RelationGetRelid(resultRelInfo->ri_RelationDesc);
4637  mtlookup = (MTTargetRelLookup *)
4638  hash_search(mtstate->mt_resultOidHash, &hashkey,
4639  HASH_ENTER, &found);
4640  Assert(!found);
4641  mtlookup->relationIndex = i;
4642  }
4643  }
4644  else
4645  mtstate->mt_resultOidHash = NULL;
4646 
4647  /*
4648  * Determine if the FDW supports batch insert and determine the batch size
4649  * (a FDW may support batching, but it may be disabled for the
4650  * server/table).
4651  *
4652  * We only do this for INSERT, so that for UPDATE/DELETE the batch size
4653  * remains set to 0.
4654  */
4655  if (operation == CMD_INSERT)
4656  {
4657  /* insert may only have one relation, inheritance is not expanded */
4658  Assert(nrels == 1);
4659  resultRelInfo = mtstate->resultRelInfo;
4660  if (!resultRelInfo->ri_usesFdwDirectModify &&
4661  resultRelInfo->ri_FdwRoutine != NULL &&
4662  resultRelInfo->ri_FdwRoutine->GetForeignModifyBatchSize &&
4663  resultRelInfo->ri_FdwRoutine->ExecForeignBatchInsert)
4664  {
4665  resultRelInfo->ri_BatchSize =
4666  resultRelInfo->ri_FdwRoutine->GetForeignModifyBatchSize(resultRelInfo);
4667  Assert(resultRelInfo->ri_BatchSize >= 1);
4668  }
4669  else
4670  resultRelInfo->ri_BatchSize = 1;
4671  }
4672 
4673  /*
4674  * Lastly, if this is not the primary (canSetTag) ModifyTable node, add it
4675  * to estate->es_auxmodifytables so that it will be run to completion by
4676  * ExecPostprocessPlan. (It'd actually work fine to add the primary
4677  * ModifyTable node too, but there's no need.) Note the use of lcons not
4678  * lappend: we need later-initialized ModifyTable nodes to be shut down
4679  * before earlier ones. This ensures that we don't throw away RETURNING
4680  * rows that need to be seen by a later CTE subplan.
4681  */
4682  if (!mtstate->canSetTag)
4683  estate->es_auxmodifytables = lcons(mtstate,
4684  estate->es_auxmodifytables);
4685 
4686  return mtstate;
4687 }
#define AttributeNumberIsValid(attributeNumber)
Definition: attnum.h:34
bool bms_is_member(int x, const Bitmapset *a)
Definition: bitmapset.c:510
unsigned int Index
Definition: c.h:614
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
Definition: dynahash.c:955
HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)
Definition: dynahash.c:352
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:224
ProjectionInfo * ExecBuildUpdateProjection(List *targetList, bool evalTargetList, List *targetColnos, TupleDesc relDesc, ExprContext *econtext, TupleTableSlot *slot, PlanState *parent)
Definition: execExpr.c:521
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:220
ProjectionInfo * ExecBuildProjectionInfo(List *targetList, ExprContext *econtext, TupleTableSlot *slot, PlanState *parent, TupleDesc inputDesc)
Definition: execExpr.c:361
AttrNumber ExecFindJunkAttributeInTlist(List *targetlist, const char *attrName)
Definition: execJunk.c:222
void CheckValidResultRel(ResultRelInfo *resultRelInfo, CmdType operation, List *mergeActions)
Definition: execMain.c:1026
void EvalPlanQualInit(EPQState *epqstate, EState *parentestate, Plan *subplan, List *auxrowmarks, int epqParam, List *resultRelations)
Definition: execMain.c:2539
ExecAuxRowMark * ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist)
Definition: execMain.c:2400
void EvalPlanQualSetPlan(EPQState *epqstate, Plan *subplan, List *auxrowmarks)
Definition: execMain.c:2581
ExecRowMark * ExecFindRowMark(EState *estate, Index rti, bool missing_ok)
Definition: execMain.c:2377
PartitionTupleRouting * ExecSetupPartitionTupleRouting(EState *estate, Relation rel)
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
Definition: execProcnode.c:142
const TupleTableSlotOps TTSOpsVirtual
Definition: execTuples.c:84
void ExecInitResultTypeTL(PlanState *planstate)
Definition: execTuples.c:1842
void ExecInitResultTupleSlotTL(PlanState *planstate, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1886
void ExecInitResultRelation(EState *estate, ResultRelInfo *resultRelInfo, Index rti)
Definition: execUtils.c:814
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:483
#define EXEC_FLAG_BACKWARD
Definition: executor.h:68
#define EXEC_FLAG_EXPLAIN_ONLY
Definition: executor.h:65
#define EXEC_FLAG_MARK
Definition: executor.h:69
@ HASH_ENTER
Definition: hsearch.h:114
#define HASH_CONTEXT
Definition: hsearch.h:102
#define HASH_ELEM
Definition: hsearch.h:95
#define HASH_BLOBS
Definition: hsearch.h:97
List * lappend(List *list, void *datum)
Definition: list.c:339
List * lcons(void *datum, List *list)
Definition: list.c:495
MemoryContext CurrentMemoryContext
Definition: mcxt.c:143
static void ExecSetupTransitionCaptureState(ModifyTableState *mtstate, EState *estate)
static TupleTableSlot * ExecModifyTable(PlanState *pstate)
struct MTTargetRelLookup MTTargetRelLookup
#define MT_NRELS_HASH
static void ExecInitMerge(ModifyTableState *mtstate, EState *estate)
@ ONCONFLICT_NONE
Definition: nodes.h:418
@ ONCONFLICT_UPDATE
Definition: nodes.h:420
CmdType
Definition: nodes.h:263
@ CMD_MERGE
Definition: nodes.h:269
@ CMD_INSERT
Definition: nodes.h:267
@ CMD_DELETE
Definition: nodes.h:268
#define makeNode(_type_)
Definition: nodes.h:155
#define lfirst(lc)
Definition: pg_list.h:172
#define lfirst_node(type, lc)
Definition: pg_list.h:176
static int list_length(const List *l)
Definition: pg_list.h:152
#define NIL
Definition: pg_list.h:68
#define lfirst_int(lc)
Definition: pg_list.h:173
#define linitial_int(l)
Definition: pg_list.h:179
#define linitial(l)
Definition: pg_list.h:178
static void * list_nth(const List *list, int n)
Definition: pg_list.h:299
#define outerPlan(node)
Definition: plannodes.h:182
#define InvalidOid
Definition: postgres_ext.h:36
unsigned int Oid
Definition: postgres_ext.h:31
#define RelationGetRelid(relation)
Definition: rel.h:505
List * es_auxmodifytables
Definition: execnodes.h:684
BeginForeignModify_function BeginForeignModify
Definition: fdwapi.h:231
ExecForeignBatchInsert_function ExecForeignBatchInsert
Definition: fdwapi.h:233
GetForeignModifyBatchSize_function GetForeignModifyBatchSize
Definition: fdwapi.h:234
Size keysize
Definition: hsearch.h:75
Size entrysize
Definition: hsearch.h:76
MemoryContext hcxt
Definition: hsearch.h:86
Definition: pg_list.h:54
CmdType operation
Definition: execnodes.h:1355
TupleTableSlot * mt_merge_pending_not_matched
Definition: execnodes.h:1409
double mt_merge_deleted
Definition: execnodes.h:1414
double mt_merge_inserted
Definition: execnodes.h:1412
double mt_merge_updated
Definition: execnodes.h:1413
HTAB * mt_resultOidHash
Definition: execnodes.h:1381
ResultRelInfo * rootResultRelInfo
Definition: execnodes.h:1367
List * arbiterIndexes
Definition: plannodes.h:246
List * onConflictCols
Definition: plannodes.h:248
CmdType operation
Definition: plannodes.h:232
int epqParam
Definition: plannodes.h:244
List * resultRelations
Definition: plannodes.h:237
Bitmapset * fdwDirectModifyPlans
Definition: plannodes.h:242
List * onConflictSet
Definition: plannodes.h:247
List * mergeActionLists
Definition: plannodes.h:252
bool canSetTag
Definition: plannodes.h:233
List * fdwPrivLists
Definition: plannodes.h:241
List * returningLists
Definition: plannodes.h:240
List * withCheckOptionLists
Definition: plannodes.h:239
Index rootRelation
Definition: plannodes.h:235
Node * onConflictWhere
Definition: plannodes.h:249
List * rowMarks
Definition: plannodes.h:243
OnConflictAction onConflictAction
Definition: plannodes.h:245
TupleTableSlot * oc_ProjSlot
Definition: execnodes.h:410
TupleTableSlot * oc_Existing
Definition: execnodes.h:409
ExprState * oc_WhereClause
Definition: execnodes.h:412
ProjectionInfo * oc_ProjInfo
Definition: execnodes.h:411
bool isParent
Definition: plannodes.h:1389
Plan * plan
Definition: execnodes.h:1116
ExprContext * ps_ExprContext
Definition: execnodes.h:1155
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:1154
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:1122
List * targetlist
Definition: plannodes.h:152
TupleDesc rd_att
Definition: rel.h:112
Form_pg_class rd_rel
Definition: rel.h:111
OnConflictSetState * ri_onConflict
Definition: execnodes.h:545
List * ri_onConflictArbiterIndexes
Definition: execnodes.h:542
struct ResultRelInfo * ri_RootResultRelInfo
Definition: execnodes.h:582
List * ri_WithCheckOptions
Definition: execnodes.h:519
List * ri_WithCheckOptionExprs
Definition: execnodes.h:522
ProjectionInfo * ri_projectReturning
Definition: execnodes.h:539
List * ri_returningList
Definition: execnodes.h:536
AttrNumber ri_RowIdAttNo
Definition: execnodes.h:471
int ri_BatchSize
Definition: execnodes.h:514

References ModifyTable::arbiterIndexes, Assert, AttributeNumberIsValid, FdwRoutine::BeginForeignModify, bms_is_member(), ModifyTableState::canSetTag, ModifyTable::canSetTag, CheckValidResultRel(), CMD_DELETE, CMD_INSERT, CMD_MERGE, CMD_UPDATE, CurrentMemoryContext, elog, HASHCTL::entrysize, ModifyTable::epqParam, ERROR, EState::es_auxmodifytables, EState::es_tupleTable, EvalPlanQualInit(), EvalPlanQualSetPlan(), EXEC_FLAG_BACKWARD, EXEC_FLAG_EXPLAIN_ONLY, EXEC_FLAG_MARK, ExecAssignExprContext(), ExecBuildAuxRowMark(), ExecBuildProjectionInfo(), ExecBuildUpdateProjection(), ExecFindJunkAttributeInTlist(), ExecFindRowMark(), FdwRoutine::ExecForeignBatchInsert, ExecInitMerge(), ExecInitNode(), ExecInitQual(), ExecInitResultRelation(), ExecInitResultTupleSlotTL(), ExecInitResultTypeTL(), ExecModifyTable(), PlanState::ExecProcNode, ExecSetupPartitionTupleRouting(), ExecSetupTransitionCaptureState(), ModifyTable::fdwDirectModifyPlans, ModifyTable::fdwPrivLists, ModifyTableState::fireBSTriggers, FdwRoutine::GetForeignModifyBatchSize, HASH_BLOBS, HASH_CONTEXT, hash_create(), HASH_ELEM, HASH_ENTER, hash_search(), HASHCTL::hcxt, i, InvalidOid, PlanRowMark::isParent, HASHCTL::keysize, lappend(), lcons(), lfirst, lfirst_int, lfirst_node, linitial, linitial_int, list_length(), list_nth(), makeNode, ModifyTable::mergeActionLists, ModifyTableState::mt_done, ModifyTableState::mt_epqstate, ModifyTableState::mt_lastResultIndex, ModifyTableState::mt_lastResultOid, ModifyTableState::mt_merge_deleted, ModifyTableState::mt_merge_inserted, ModifyTableState::mt_merge_pending_not_matched, ModifyTableState::mt_merge_updated, ModifyTableState::mt_nrels, MT_NRELS_HASH, ModifyTableState::mt_partition_tuple_routing, ModifyTableState::mt_resultOidAttno, ModifyTableState::mt_resultOidHash, NIL, OnConflictSetState::oc_Existing, OnConflictSetState::oc_ProjInfo, OnConflictSetState::oc_ProjSlot, OnConflictSetState::oc_WhereClause, ONCONFLICT_NONE, ONCONFLICT_UPDATE, ModifyTable::onConflictAction, ModifyTable::onConflictCols, ModifyTable::onConflictSet, ModifyTable::onConflictWhere, ModifyTableState::operation, ModifyTable::operation, outerPlan, outerPlanState, palloc(), PlanState::plan, ModifyTableState::ps, PlanState::ps_ExprContext, PlanState::ps_ResultTupleSlot, WithCheckOption::qual, RelationData::rd_att, RelationData::rd_rel, RelationGetRelid, MTTargetRelLookup::relationIndex, ModifyTable::resultRelations, ModifyTableState::resultRelInfo, ModifyTable::returningLists, ResultRelInfo::ri_BatchSize, ResultRelInfo::ri_FdwRoutine, ResultRelInfo::ri_onConflict, ResultRelInfo::ri_onConflictArbiterIndexes, ResultRelInfo::ri_projectReturning, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_returningList, ResultRelInfo::ri_RootResultRelInfo, ResultRelInfo::ri_RowIdAttNo, ResultRelInfo::ri_usesFdwDirectModify, ResultRelInfo::ri_WithCheckOptionExprs, ResultRelInfo::ri_WithCheckOptions, ModifyTable::rootRelation, ModifyTableState::rootResultRelInfo, ModifyTable::rowMarks, PlanRowMark::rti, PlanState::state, table_slot_create(), Plan::targetlist, TTSOpsVirtual, and ModifyTable::withCheckOptionLists.

Referenced by ExecInitNode().

◆ ExecInitStoredGenerated()

void ExecInitStoredGenerated ( ResultRelInfo resultRelInfo,
EState estate,
CmdType  cmdtype 
)

Definition at line 352 of file nodeModifyTable.c.

355 {
356  Relation rel = resultRelInfo->ri_RelationDesc;
357  TupleDesc tupdesc = RelationGetDescr(rel);
358  int natts = tupdesc->natts;
359  ExprState **ri_GeneratedExprs;
360  int ri_NumGeneratedNeeded;
361  Bitmapset *updatedCols;
362  MemoryContext oldContext;
363 
364  /* Nothing to do if no generated columns */
365  if (!(tupdesc->constr && tupdesc->constr->has_generated_stored))
366  return;
367 
368  /*
369  * In an UPDATE, we can skip computing any generated columns that do not
370  * depend on any UPDATE target column. But if there is a BEFORE ROW
371  * UPDATE trigger, we cannot skip because the trigger might change more
372  * columns.
373  */
374  if (cmdtype == CMD_UPDATE &&
375  !(rel->trigdesc && rel->trigdesc->trig_update_before_row))
376  updatedCols = ExecGetUpdatedCols(resultRelInfo, estate);
377  else
378  updatedCols = NULL;
379 
380  /*
381  * Make sure these data structures are built in the per-query memory
382  * context so they'll survive throughout the query.
383  */
384  oldContext = MemoryContextSwitchTo(estate->es_query_cxt);
385 
386  ri_GeneratedExprs = (ExprState **) palloc0(natts * sizeof(ExprState *));
387  ri_NumGeneratedNeeded = 0;
388 
389  for (int i = 0; i < natts; i++)
390  {
391  if (TupleDescAttr(tupdesc, i)->attgenerated == ATTRIBUTE_GENERATED_STORED)
392  {
393  Expr *expr;
394 
395  /* Fetch the GENERATED AS expression tree */
396  expr = (Expr *) build_column_default(rel, i + 1);
397  if (expr == NULL)
398  elog(ERROR, "no generation expression found for column number %d of table \"%s\"",
399  i + 1, RelationGetRelationName(rel));
400 
401  /*
402  * If it's an update with a known set of update target columns,
403  * see if we can skip the computation.
404  */
405  if (updatedCols)
406  {
407  Bitmapset *attrs_used = NULL;
408 
409  pull_varattnos((Node *) expr, 1, &attrs_used);
410 
411  if (!bms_overlap(updatedCols, attrs_used))
412  continue; /* need not update this column */
413  }
414 
415  /* No luck, so prepare the expression for execution */
416  ri_GeneratedExprs[i] = ExecPrepareExpr(expr, estate);
417  ri_NumGeneratedNeeded++;
418 
419  /* If UPDATE, mark column in resultRelInfo->ri_extraUpdatedCols */
420  if (cmdtype == CMD_UPDATE)
421  resultRelInfo->ri_extraUpdatedCols =
422  bms_add_member(resultRelInfo->ri_extraUpdatedCols,
424  }
425  }
426 
427  /* Save in appropriate set of fields */
428  if (cmdtype == CMD_UPDATE)
429  {
430  /* Don't call twice */
431  Assert(resultRelInfo->ri_GeneratedExprsU == NULL);
432 
433  resultRelInfo->ri_GeneratedExprsU = ri_GeneratedExprs;
434  resultRelInfo->ri_NumGeneratedNeededU = ri_NumGeneratedNeeded;
435  }
436  else
437  {
438  /* Don't call twice */
439  Assert(resultRelInfo->ri_GeneratedExprsI == NULL);
440 
441  resultRelInfo->ri_GeneratedExprsI = ri_GeneratedExprs;
442  resultRelInfo->ri_NumGeneratedNeededI = ri_NumGeneratedNeeded;
443  }
444 
445  MemoryContextSwitchTo(oldContext);
446 }
Bitmapset * bms_add_member(Bitmapset *a, int x)
Definition: bitmapset.c:815
bool bms_overlap(const Bitmapset *a, const Bitmapset *b)
Definition: bitmapset.c:582
ExprState * ExecPrepareExpr(Expr *node, EState *estate)
Definition: execExpr.c:739
Bitmapset * ExecGetUpdatedCols(ResultRelInfo *relinfo, EState *estate)
Definition: execUtils.c:1288
void * palloc0(Size size)
Definition: mcxt.c:1347
#define RelationGetRelationName(relation)
Definition: rel.h:539
Node * build_column_default(Relation rel, int attrno)
MemoryContext es_query_cxt
Definition: execnodes.h:667
Definition: nodes.h:129
TriggerDesc * trigdesc
Definition: rel.h:117
Bitmapset * ri_extraUpdatedCols
Definition: execnodes.h:474
bool trig_update_before_row
Definition: reltrigger.h:61
#define FirstLowInvalidHeapAttributeNumber
Definition: sysattr.h:27
void pull_varattnos(Node *node, Index varno, Bitmapset **varattnos)
Definition: var.c:291

References Assert, bms_add_member(), bms_overlap(), build_column_default(), CMD_UPDATE, TupleDescData::constr, elog, ERROR, EState::es_query_cxt, ExecGetUpdatedCols(), ExecPrepareExpr(), FirstLowInvalidHeapAttributeNumber, TupleConstr::has_generated_stored, i, MemoryContextSwitchTo(), TupleDescData::natts, palloc0(), pull_varattnos(), RelationGetDescr, RelationGetRelationName, ResultRelInfo::ri_extraUpdatedCols, ResultRelInfo::ri_GeneratedExprsI, ResultRelInfo::ri_GeneratedExprsU, ResultRelInfo::ri_NumGeneratedNeededI, ResultRelInfo::ri_NumGeneratedNeededU, ResultRelInfo::ri_RelationDesc, TriggerDesc::trig_update_before_row, RelationData::trigdesc, and TupleDescAttr.

Referenced by ExecComputeStoredGenerated(), and ExecGetExtraUpdatedCols().

◆ ExecReScanModifyTable()

void ExecReScanModifyTable ( ModifyTableState node)

Definition at line 4752 of file nodeModifyTable.c.

4753 {
4754  /*
4755  * Currently, we don't need to support rescan on ModifyTable nodes. The
4756  * semantics of that would be a bit debatable anyway.
4757  */
4758  elog(ERROR, "ExecReScanModifyTable is not implemented");
4759 }

References elog, and ERROR.

Referenced by ExecReScan().