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:861
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:561
#define GetPerTupleMemoryContext(estate)
Definition: executor.h:566
static Datum ExecEvalExpr(ExprState *state, ExprContext *econtext, bool *isNull)
Definition: executor.h:344
long val
Definition: informix.c:689
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:258
Relation ri_RelationDesc
Definition: execnodes.h:459
ExprState ** ri_GeneratedExprsI
Definition: execnodes.h:536
int ri_NumGeneratedNeededU
Definition: execnodes.h:541
ExprState ** ri_GeneratedExprsU
Definition: execnodes.h:537
int ri_NumGeneratedNeededI
Definition: execnodes.h:540
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 4765 of file nodeModifyTable.c.

4766 {
4767  int i;
4768 
4769  /*
4770  * Allow any FDWs to shut down
4771  */
4772  for (i = 0; i < node->mt_nrels; i++)
4773  {
4774  int j;
4775  ResultRelInfo *resultRelInfo = node->resultRelInfo + i;
4776 
4777  if (!resultRelInfo->ri_usesFdwDirectModify &&
4778  resultRelInfo->ri_FdwRoutine != NULL &&
4779  resultRelInfo->ri_FdwRoutine->EndForeignModify != NULL)
4780  resultRelInfo->ri_FdwRoutine->EndForeignModify(node->ps.state,
4781  resultRelInfo);
4782 
4783  /*
4784  * Cleanup the initialized batch slots. This only matters for FDWs
4785  * with batching, but the other cases will have ri_NumSlotsInitialized
4786  * == 0.
4787  */
4788  for (j = 0; j < resultRelInfo->ri_NumSlotsInitialized; j++)
4789  {
4790  ExecDropSingleTupleTableSlot(resultRelInfo->ri_Slots[j]);
4791  ExecDropSingleTupleTableSlot(resultRelInfo->ri_PlanSlots[j]);
4792  }
4793  }
4794 
4795  /*
4796  * Close all the partitioned tables, leaf partitions, and their indices
4797  * and release the slot used for tuple routing, if set.
4798  */
4799  if (node->mt_partition_tuple_routing)
4800  {
4802 
4803  if (node->mt_root_tuple_slot)
4805  }
4806 
4807  /*
4808  * Terminate EPQ execution if active
4809  */
4810  EvalPlanQualEnd(&node->mt_epqstate);
4811 
4812  /*
4813  * shut down subplan
4814  */
4815  ExecEndNode(outerPlanState(node));
4816 }
void EvalPlanQualEnd(EPQState *epqstate)
Definition: execMain.c:2986
void ExecCleanupTupleRouting(ModifyTableState *mtstate, PartitionTupleRouting *proute)
void ExecEndNode(PlanState *node)
Definition: execProcnode.c:562
void ExecDropSingleTupleTableSlot(TupleTableSlot *slot)
Definition: execTuples.c:1341
#define outerPlanState(node)
Definition: execnodes.h:1224
int j
Definition: isn.c:74
EndForeignModify_function EndForeignModify
Definition: fdwapi.h:237
ResultRelInfo * resultRelInfo
Definition: execnodes.h:1371
struct PartitionTupleRouting * mt_partition_tuple_routing
Definition: execnodes.h:1402
TupleTableSlot * mt_root_tuple_slot
Definition: execnodes.h:1399
EPQState mt_epqstate
Definition: execnodes.h:1381
PlanState ps
Definition: execnodes.h:1366
EState * state
Definition: execnodes.h:1130
TupleTableSlot ** ri_Slots
Definition: execnodes.h:521
int ri_NumSlotsInitialized
Definition: execnodes.h:519
struct FdwRoutine * ri_FdwRoutine
Definition: execnodes.h:509
TupleTableSlot ** ri_PlanSlots
Definition: execnodes.h:522
bool ri_usesFdwDirectModify
Definition: execnodes.h:515

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 3620 of file nodeModifyTable.c.

3622 {
3623  EState *estate = mtstate->ps.state;
3624 
3625  Assert(!resultRelInfo->ri_projectNewInfoValid);
3626 
3627  resultRelInfo->ri_oldTupleSlot =
3628  table_slot_create(resultRelInfo->ri_RelationDesc,
3629  &estate->es_tupleTable);
3630  resultRelInfo->ri_newTupleSlot =
3631  table_slot_create(resultRelInfo->ri_RelationDesc,
3632  &estate->es_tupleTable);
3633  resultRelInfo->ri_projectNewInfoValid = true;
3634 }
List * es_tupleTable
Definition: execnodes.h:677
bool ri_projectNewInfoValid
Definition: execnodes.h:486
TupleTableSlot * ri_oldTupleSlot
Definition: execnodes.h:484
TupleTableSlot * ri_newTupleSlot
Definition: execnodes.h:482
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 4280 of file nodeModifyTable.c.

4281 {
4282  ModifyTableState *mtstate;
4283  Plan *subplan = outerPlan(node);
4284  CmdType operation = node->operation;
4285  int nrels = list_length(node->resultRelations);
4286  ResultRelInfo *resultRelInfo;
4287  List *arowmarks;
4288  ListCell *l;
4289  int i;
4290  Relation rel;
4291 
4292  /* check for unsupported flags */
4293  Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
4294 
4295  /*
4296  * create state structure
4297  */
4298  mtstate = makeNode(ModifyTableState);
4299  mtstate->ps.plan = (Plan *) node;
4300  mtstate->ps.state = estate;
4301  mtstate->ps.ExecProcNode = ExecModifyTable;
4302 
4303  mtstate->operation = operation;
4304  mtstate->canSetTag = node->canSetTag;
4305  mtstate->mt_done = false;
4306 
4307  mtstate->mt_nrels = nrels;
4308  mtstate->resultRelInfo = (ResultRelInfo *)
4309  palloc(nrels * sizeof(ResultRelInfo));
4310 
4311  mtstate->mt_merge_pending_not_matched = NULL;
4312  mtstate->mt_merge_inserted = 0;
4313  mtstate->mt_merge_updated = 0;
4314  mtstate->mt_merge_deleted = 0;
4315 
4316  /*----------
4317  * Resolve the target relation. This is the same as:
4318  *
4319  * - the relation for which we will fire FOR STATEMENT triggers,
4320  * - the relation into whose tuple format all captured transition tuples
4321  * must be converted, and
4322  * - the root partitioned table used for tuple routing.
4323  *
4324  * If it's a partitioned or inherited table, the root partition or
4325  * appendrel RTE doesn't appear elsewhere in the plan and its RT index is
4326  * given explicitly in node->rootRelation. Otherwise, the target relation
4327  * is the sole relation in the node->resultRelations list.
4328  *----------
4329  */
4330  if (node->rootRelation > 0)
4331  {
4333  ExecInitResultRelation(estate, mtstate->rootResultRelInfo,
4334  node->rootRelation);
4335  }
4336  else
4337  {
4338  Assert(list_length(node->resultRelations) == 1);
4339  mtstate->rootResultRelInfo = mtstate->resultRelInfo;
4340  ExecInitResultRelation(estate, mtstate->resultRelInfo,
4341  linitial_int(node->resultRelations));
4342  }
4343 
4344  /* set up epqstate with dummy subplan data for the moment */
4345  EvalPlanQualInit(&mtstate->mt_epqstate, estate, NULL, NIL,
4346  node->epqParam, node->resultRelations);
4347  mtstate->fireBSTriggers = true;
4348 
4349  /*
4350  * Build state for collecting transition tuples. This requires having a
4351  * valid trigger query context, so skip it in explain-only mode.
4352  */
4353  if (!(eflags & EXEC_FLAG_EXPLAIN_ONLY))
4354  ExecSetupTransitionCaptureState(mtstate, estate);
4355 
4356  /*
4357  * Open all the result relations and initialize the ResultRelInfo structs.
4358  * (But root relation was initialized above, if it's part of the array.)
4359  * We must do this before initializing the subplan, because direct-modify
4360  * FDWs expect their ResultRelInfos to be available.
4361  */
4362  resultRelInfo = mtstate->resultRelInfo;
4363  i = 0;
4364  foreach(l, node->resultRelations)
4365  {
4366  Index resultRelation = lfirst_int(l);
4367  List *mergeActions = NIL;
4368 
4369  if (node->mergeActionLists)
4370  mergeActions = list_nth(node->mergeActionLists, i);
4371 
4372  if (resultRelInfo != mtstate->rootResultRelInfo)
4373  {
4374  ExecInitResultRelation(estate, resultRelInfo, resultRelation);
4375 
4376  /*
4377  * For child result relations, store the root result relation
4378  * pointer. We do so for the convenience of places that want to
4379  * look at the query's original target relation but don't have the
4380  * mtstate handy.
4381  */
4382  resultRelInfo->ri_RootResultRelInfo = mtstate->rootResultRelInfo;
4383  }
4384 
4385  /* Initialize the usesFdwDirectModify flag */
4386  resultRelInfo->ri_usesFdwDirectModify =
4388 
4389  /*
4390  * Verify result relation is a valid target for the current operation
4391  */
4392  CheckValidResultRel(resultRelInfo, operation, mergeActions);
4393 
4394  resultRelInfo++;
4395  i++;
4396  }
4397 
4398  /*
4399  * Now we may initialize the subplan.
4400  */
4401  outerPlanState(mtstate) = ExecInitNode(subplan, estate, eflags);
4402 
4403  /*
4404  * Do additional per-result-relation initialization.
4405  */
4406  for (i = 0; i < nrels; i++)
4407  {
4408  resultRelInfo = &mtstate->resultRelInfo[i];
4409 
4410  /* Let FDWs init themselves for foreign-table result rels */
4411  if (!resultRelInfo->ri_usesFdwDirectModify &&
4412  resultRelInfo->ri_FdwRoutine != NULL &&
4413  resultRelInfo->ri_FdwRoutine->BeginForeignModify != NULL)
4414  {
4415  List *fdw_private = (List *) list_nth(node->fdwPrivLists, i);
4416 
4417  resultRelInfo->ri_FdwRoutine->BeginForeignModify(mtstate,
4418  resultRelInfo,
4419  fdw_private,
4420  i,
4421  eflags);
4422  }
4423 
4424  /*
4425  * For UPDATE/DELETE/MERGE, find the appropriate junk attr now, either
4426  * a 'ctid' or 'wholerow' attribute depending on relkind. For foreign
4427  * tables, the FDW might have created additional junk attr(s), but
4428  * those are no concern of ours.
4429  */
4430  if (operation == CMD_UPDATE || operation == CMD_DELETE ||
4431  operation == CMD_MERGE)
4432  {
4433  char relkind;
4434 
4435  relkind = resultRelInfo->ri_RelationDesc->rd_rel->relkind;
4436  if (relkind == RELKIND_RELATION ||
4437  relkind == RELKIND_MATVIEW ||
4438  relkind == RELKIND_PARTITIONED_TABLE)
4439  {
4440  resultRelInfo->ri_RowIdAttNo =
4441  ExecFindJunkAttributeInTlist(subplan->targetlist, "ctid");
4442  if (!AttributeNumberIsValid(resultRelInfo->ri_RowIdAttNo))
4443  elog(ERROR, "could not find junk ctid column");
4444  }
4445  else if (relkind == RELKIND_FOREIGN_TABLE)
4446  {
4447  /*
4448  * We don't support MERGE with foreign tables for now. (It's
4449  * problematic because the implementation uses CTID.)
4450  */
4451  Assert(operation != CMD_MERGE);
4452 
4453  /*
4454  * When there is a row-level trigger, there should be a
4455  * wholerow attribute. We also require it to be present in
4456  * UPDATE and MERGE, so we can get the values of unchanged
4457  * columns.
4458  */
4459  resultRelInfo->ri_RowIdAttNo =
4461  "wholerow");
4462  if ((mtstate->operation == CMD_UPDATE || mtstate->operation == CMD_MERGE) &&
4463  !AttributeNumberIsValid(resultRelInfo->ri_RowIdAttNo))
4464  elog(ERROR, "could not find junk wholerow column");
4465  }
4466  else
4467  {
4468  /* Other valid target relkinds must provide wholerow */
4469  resultRelInfo->ri_RowIdAttNo =
4471  "wholerow");
4472  if (!AttributeNumberIsValid(resultRelInfo->ri_RowIdAttNo))
4473  elog(ERROR, "could not find junk wholerow column");
4474  }
4475  }
4476  }
4477 
4478  /*
4479  * If this is an inherited update/delete/merge, there will be a junk
4480  * attribute named "tableoid" present in the subplan's targetlist. It
4481  * will be used to identify the result relation for a given tuple to be
4482  * updated/deleted/merged.
4483  */
4484  mtstate->mt_resultOidAttno =
4485  ExecFindJunkAttributeInTlist(subplan->targetlist, "tableoid");
4486  Assert(AttributeNumberIsValid(mtstate->mt_resultOidAttno) || nrels == 1);
4487  mtstate->mt_lastResultOid = InvalidOid; /* force lookup at first tuple */
4488  mtstate->mt_lastResultIndex = 0; /* must be zero if no such attr */
4489 
4490  /* Get the root target relation */
4491  rel = mtstate->rootResultRelInfo->ri_RelationDesc;
4492 
4493  /*
4494  * Build state for tuple routing if it's a partitioned INSERT. An UPDATE
4495  * or MERGE might need this too, but only if it actually moves tuples
4496  * between partitions; in that case setup is done by
4497  * ExecCrossPartitionUpdate.
4498  */
4499  if (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE &&
4500  operation == CMD_INSERT)
4501  mtstate->mt_partition_tuple_routing =
4502  ExecSetupPartitionTupleRouting(estate, rel);
4503 
4504  /*
4505  * Initialize any WITH CHECK OPTION constraints if needed.
4506  */
4507  resultRelInfo = mtstate->resultRelInfo;
4508  foreach(l, node->withCheckOptionLists)
4509  {
4510  List *wcoList = (List *) lfirst(l);
4511  List *wcoExprs = NIL;
4512  ListCell *ll;
4513 
4514  foreach(ll, wcoList)
4515  {
4516  WithCheckOption *wco = (WithCheckOption *) lfirst(ll);
4517  ExprState *wcoExpr = ExecInitQual((List *) wco->qual,
4518  &mtstate->ps);
4519 
4520  wcoExprs = lappend(wcoExprs, wcoExpr);
4521  }
4522 
4523  resultRelInfo->ri_WithCheckOptions = wcoList;
4524  resultRelInfo->ri_WithCheckOptionExprs = wcoExprs;
4525  resultRelInfo++;
4526  }
4527 
4528  /*
4529  * Initialize RETURNING projections if needed.
4530  */
4531  if (node->returningLists)
4532  {
4533  TupleTableSlot *slot;
4534  ExprContext *econtext;
4535 
4536  /*
4537  * Initialize result tuple slot and assign its rowtype using the first
4538  * RETURNING list. We assume the rest will look the same.
4539  */
4540  mtstate->ps.plan->targetlist = (List *) linitial(node->returningLists);
4541 
4542  /* Set up a slot for the output of the RETURNING projection(s) */
4544  slot = mtstate->ps.ps_ResultTupleSlot;
4545 
4546  /* Need an econtext too */
4547  if (mtstate->ps.ps_ExprContext == NULL)
4548  ExecAssignExprContext(estate, &mtstate->ps);
4549  econtext = mtstate->ps.ps_ExprContext;
4550 
4551  /*
4552  * Build a projection for each result rel.
4553  */
4554  resultRelInfo = mtstate->resultRelInfo;
4555  foreach(l, node->returningLists)
4556  {
4557  List *rlist = (List *) lfirst(l);
4558 
4559  resultRelInfo->ri_returningList = rlist;
4560  resultRelInfo->ri_projectReturning =
4561  ExecBuildProjectionInfo(rlist, econtext, slot, &mtstate->ps,
4562  resultRelInfo->ri_RelationDesc->rd_att);
4563  resultRelInfo++;
4564  }
4565  }
4566  else
4567  {
4568  /*
4569  * We still must construct a dummy result tuple type, because InitPlan
4570  * expects one (maybe should change that?).
4571  */
4572  mtstate->ps.plan->targetlist = NIL;
4573  ExecInitResultTypeTL(&mtstate->ps);
4574 
4575  mtstate->ps.ps_ExprContext = NULL;
4576  }
4577 
4578  /* Set the list of arbiter indexes if needed for ON CONFLICT */
4579  resultRelInfo = mtstate->resultRelInfo;
4580  if (node->onConflictAction != ONCONFLICT_NONE)
4581  {
4582  /* insert may only have one relation, inheritance is not expanded */
4583  Assert(nrels == 1);
4584  resultRelInfo->ri_onConflictArbiterIndexes = node->arbiterIndexes;
4585  }
4586 
4587  /*
4588  * If needed, Initialize target list, projection and qual for ON CONFLICT
4589  * DO UPDATE.
4590  */
4591  if (node->onConflictAction == ONCONFLICT_UPDATE)
4592  {
4594  ExprContext *econtext;
4595  TupleDesc relationDesc;
4596 
4597  /* already exists if created by RETURNING processing above */
4598  if (mtstate->ps.ps_ExprContext == NULL)
4599  ExecAssignExprContext(estate, &mtstate->ps);
4600 
4601  econtext = mtstate->ps.ps_ExprContext;
4602  relationDesc = resultRelInfo->ri_RelationDesc->rd_att;
4603 
4604  /* create state for DO UPDATE SET operation */
4605  resultRelInfo->ri_onConflict = onconfl;
4606 
4607  /* initialize slot for the existing tuple */
4608  onconfl->oc_Existing =
4609  table_slot_create(resultRelInfo->ri_RelationDesc,
4610  &mtstate->ps.state->es_tupleTable);
4611 
4612  /*
4613  * Create the tuple slot for the UPDATE SET projection. We want a slot
4614  * of the table's type here, because the slot will be used to insert
4615  * into the table, and for RETURNING processing - which may access
4616  * system attributes.
4617  */
4618  onconfl->oc_ProjSlot =
4619  table_slot_create(resultRelInfo->ri_RelationDesc,
4620  &mtstate->ps.state->es_tupleTable);
4621 
4622  /* build UPDATE SET projection state */
4623  onconfl->oc_ProjInfo =
4625  true,
4626  node->onConflictCols,
4627  relationDesc,
4628  econtext,
4629  onconfl->oc_ProjSlot,
4630  &mtstate->ps);
4631 
4632  /* initialize state to evaluate the WHERE clause, if any */
4633  if (node->onConflictWhere)
4634  {
4635  ExprState *qualexpr;
4636 
4637  qualexpr = ExecInitQual((List *) node->onConflictWhere,
4638  &mtstate->ps);
4639  onconfl->oc_WhereClause = qualexpr;
4640  }
4641  }
4642 
4643  /*
4644  * If we have any secondary relations in an UPDATE or DELETE, they need to
4645  * be treated like non-locked relations in SELECT FOR UPDATE, i.e., the
4646  * EvalPlanQual mechanism needs to be told about them. This also goes for
4647  * the source relations in a MERGE. Locate the relevant ExecRowMarks.
4648  */
4649  arowmarks = NIL;
4650  foreach(l, node->rowMarks)
4651  {
4653  ExecRowMark *erm;
4654  ExecAuxRowMark *aerm;
4655 
4656  /* ignore "parent" rowmarks; they are irrelevant at runtime */
4657  if (rc->isParent)
4658  continue;
4659 
4660  /* Find ExecRowMark and build ExecAuxRowMark */
4661  erm = ExecFindRowMark(estate, rc->rti, false);
4662  aerm = ExecBuildAuxRowMark(erm, subplan->targetlist);
4663  arowmarks = lappend(arowmarks, aerm);
4664  }
4665 
4666  /* For a MERGE command, initialize its state */
4667  if (mtstate->operation == CMD_MERGE)
4668  ExecInitMerge(mtstate, estate);
4669 
4670  EvalPlanQualSetPlan(&mtstate->mt_epqstate, subplan, arowmarks);
4671 
4672  /*
4673  * If there are a lot of result relations, use a hash table to speed the
4674  * lookups. If there are not a lot, a simple linear search is faster.
4675  *
4676  * It's not clear where the threshold is, but try 64 for starters. In a
4677  * debugging build, use a small threshold so that we get some test
4678  * coverage of both code paths.
4679  */
4680 #ifdef USE_ASSERT_CHECKING
4681 #define MT_NRELS_HASH 4
4682 #else
4683 #define MT_NRELS_HASH 64
4684 #endif
4685  if (nrels >= MT_NRELS_HASH)
4686  {
4687  HASHCTL hash_ctl;
4688 
4689  hash_ctl.keysize = sizeof(Oid);
4690  hash_ctl.entrysize = sizeof(MTTargetRelLookup);
4691  hash_ctl.hcxt = CurrentMemoryContext;
4692  mtstate->mt_resultOidHash =
4693  hash_create("ModifyTable target hash",
4694  nrels, &hash_ctl,
4696  for (i = 0; i < nrels; i++)
4697  {
4698  Oid hashkey;
4699  MTTargetRelLookup *mtlookup;
4700  bool found;
4701 
4702  resultRelInfo = &mtstate->resultRelInfo[i];
4703  hashkey = RelationGetRelid(resultRelInfo->ri_RelationDesc);
4704  mtlookup = (MTTargetRelLookup *)
4705  hash_search(mtstate->mt_resultOidHash, &hashkey,
4706  HASH_ENTER, &found);
4707  Assert(!found);
4708  mtlookup->relationIndex = i;
4709  }
4710  }
4711  else
4712  mtstate->mt_resultOidHash = NULL;
4713 
4714  /*
4715  * Determine if the FDW supports batch insert and determine the batch size
4716  * (a FDW may support batching, but it may be disabled for the
4717  * server/table).
4718  *
4719  * We only do this for INSERT, so that for UPDATE/DELETE the batch size
4720  * remains set to 0.
4721  */
4722  if (operation == CMD_INSERT)
4723  {
4724  /* insert may only have one relation, inheritance is not expanded */
4725  Assert(nrels == 1);
4726  resultRelInfo = mtstate->resultRelInfo;
4727  if (!resultRelInfo->ri_usesFdwDirectModify &&
4728  resultRelInfo->ri_FdwRoutine != NULL &&
4729  resultRelInfo->ri_FdwRoutine->GetForeignModifyBatchSize &&
4730  resultRelInfo->ri_FdwRoutine->ExecForeignBatchInsert)
4731  {
4732  resultRelInfo->ri_BatchSize =
4733  resultRelInfo->ri_FdwRoutine->GetForeignModifyBatchSize(resultRelInfo);
4734  Assert(resultRelInfo->ri_BatchSize >= 1);
4735  }
4736  else
4737  resultRelInfo->ri_BatchSize = 1;
4738  }
4739 
4740  /*
4741  * Lastly, if this is not the primary (canSetTag) ModifyTable node, add it
4742  * to estate->es_auxmodifytables so that it will be run to completion by
4743  * ExecPostprocessPlan. (It'd actually work fine to add the primary
4744  * ModifyTable node too, but there's no need.) Note the use of lcons not
4745  * lappend: we need later-initialized ModifyTable nodes to be shut down
4746  * before earlier ones. This ensures that we don't throw away RETURNING
4747  * rows that need to be seen by a later CTE subplan.
4748  */
4749  if (!mtstate->canSetTag)
4750  estate->es_auxmodifytables = lcons(mtstate,
4751  estate->es_auxmodifytables);
4752 
4753  return mtstate;
4754 }
#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:617
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:225
ProjectionInfo * ExecBuildUpdateProjection(List *targetList, bool evalTargetList, List *targetColnos, TupleDesc relDesc, ExprContext *econtext, TupleTableSlot *slot, PlanState *parent)
Definition: execExpr.c:525
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:224
ProjectionInfo * ExecBuildProjectionInfo(List *targetList, ExprContext *econtext, TupleTableSlot *slot, PlanState *parent, TupleDesc inputDesc)
Definition: execExpr.c:365
AttrNumber ExecFindJunkAttributeInTlist(List *targetlist, const char *attrName)
Definition: execJunk.c:222
void CheckValidResultRel(ResultRelInfo *resultRelInfo, CmdType operation, List *mergeActions)
Definition: execMain.c:1024
void EvalPlanQualInit(EPQState *epqstate, EState *parentestate, Plan *subplan, List *auxrowmarks, int epqParam, List *resultRelations)
Definition: execMain.c:2543
ExecAuxRowMark * ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist)
Definition: execMain.c:2404
void EvalPlanQualSetPlan(EPQState *epqstate, Plan *subplan, List *auxrowmarks)
Definition: execMain.c:2585
ExecRowMark * ExecFindRowMark(EState *estate, Index rti, bool missing_ok)
Definition: execMain.c:2381
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:816
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:485
#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:183
#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:692
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:1367
TupleTableSlot * mt_merge_pending_not_matched
Definition: execnodes.h:1421
double mt_merge_deleted
Definition: execnodes.h:1426
double mt_merge_inserted
Definition: execnodes.h:1424
double mt_merge_updated
Definition: execnodes.h:1425
HTAB * mt_resultOidHash
Definition: execnodes.h:1393
ResultRelInfo * rootResultRelInfo
Definition: execnodes.h:1379
List * arbiterIndexes
Definition: plannodes.h:247
List * onConflictCols
Definition: plannodes.h:249
CmdType operation
Definition: plannodes.h:233
int epqParam
Definition: plannodes.h:245
List * resultRelations
Definition: plannodes.h:238
Bitmapset * fdwDirectModifyPlans
Definition: plannodes.h:243
List * onConflictSet
Definition: plannodes.h:248
List * mergeActionLists
Definition: plannodes.h:253
bool canSetTag
Definition: plannodes.h:234
List * fdwPrivLists
Definition: plannodes.h:242
List * returningLists
Definition: plannodes.h:241
List * withCheckOptionLists
Definition: plannodes.h:240
Index rootRelation
Definition: plannodes.h:236
Node * onConflictWhere
Definition: plannodes.h:250
List * rowMarks
Definition: plannodes.h:244
OnConflictAction onConflictAction
Definition: plannodes.h:246
TupleTableSlot * oc_ProjSlot
Definition: execnodes.h:413
TupleTableSlot * oc_Existing
Definition: execnodes.h:412
ExprState * oc_WhereClause
Definition: execnodes.h:415
ProjectionInfo * oc_ProjInfo
Definition: execnodes.h:414
bool isParent
Definition: plannodes.h:1390
Plan * plan
Definition: execnodes.h:1128
ExprContext * ps_ExprContext
Definition: execnodes.h:1167
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:1166
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:1134
List * targetlist
Definition: plannodes.h:153
TupleDesc rd_att
Definition: rel.h:112
Form_pg_class rd_rel
Definition: rel.h:111
OnConflictSetState * ri_onConflict
Definition: execnodes.h:553
List * ri_onConflictArbiterIndexes
Definition: execnodes.h:550
struct ResultRelInfo * ri_RootResultRelInfo
Definition: execnodes.h:590
List * ri_WithCheckOptions
Definition: execnodes.h:525
List * ri_WithCheckOptionExprs
Definition: execnodes.h:528
ProjectionInfo * ri_projectReturning
Definition: execnodes.h:547
List * ri_returningList
Definition: execnodes.h:544
AttrNumber ri_RowIdAttNo
Definition: execnodes.h:474
int ri_BatchSize
Definition: execnodes.h:520

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:743
Bitmapset * ExecGetUpdatedCols(ResultRelInfo *relinfo, EState *estate)
Definition: execUtils.c:1290
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:675
Definition: nodes.h:129
TriggerDesc * trigdesc
Definition: rel.h:117
Bitmapset * ri_extraUpdatedCols
Definition: execnodes.h:477
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:296

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 4819 of file nodeModifyTable.c.

4820 {
4821  /*
4822  * Currently, we don't need to support rescan on ModifyTable nodes. The
4823  * semantics of that would be a bit debatable anyway.
4824  */
4825  elog(ERROR, "ExecReScanModifyTable is not implemented");
4826 }

References elog, and ERROR.

Referenced by ExecReScan().