187 foreach(lc, targetList)
194 if (attno >= resultDesc->
natts)
196 (
errcode(ERRCODE_DATATYPE_MISMATCH),
197 errmsg(
"table row type and query-specified row type do not match"),
198 errdetail(
"Query has too many columns.")));
202 if (!attr->attisdropped)
207 (
errcode(ERRCODE_DATATYPE_MISMATCH),
208 errmsg(
"table row type and query-specified row type do not match"),
209 errdetail(
"Table has type %s at ordinal position %d, but query expects %s.",
224 (
errcode(ERRCODE_DATATYPE_MISMATCH),
225 errmsg(
"table row type and query-specified row type do not match"),
226 errdetail(
"Query provides a value for a dropped column at ordinal position %d.",
230 if (attno != resultDesc->
natts)
232 (
errcode(ERRCODE_DATATYPE_MISMATCH),
233 errmsg(
"table row type and query-specified row type do not match"),
234 errdetail(
"Query has too few columns.")));
308 errmsg(
"could not serialize access due to concurrent update")));
328 elog(
ERROR,
"failed to fetch conflicting tuple for ON CONFLICT");
352 int natts = tupdesc->
natts;
354 int ri_NumGeneratedNeeded;
381 ri_NumGeneratedNeeded = 0;
383 for (
int i = 0;
i < natts;
i++)
385 if (
TupleDescAttr(tupdesc,
i)->attgenerated == ATTRIBUTE_GENERATED_STORED)
392 elog(
ERROR,
"no generation expression found for column number %d of table \"%s\"",
411 ri_NumGeneratedNeeded++;
452 int natts = tupdesc->
natts;
486 nulls =
palloc(
sizeof(*nulls) * natts);
489 memcpy(nulls, slot->
tts_isnull,
sizeof(*nulls) * natts);
491 for (
int i = 0;
i < natts;
i++)
495 if (ri_GeneratedExprs[
i])
500 Assert(attr->attgenerated == ATTRIBUTE_GENERATED_STORED);
525 memcpy(slot->
tts_isnull, nulls,
sizeof(*nulls) * natts);
549 bool need_projection =
false;
553 foreach(l, subplan->targetlist)
558 insertTargetList =
lappend(insertTargetList, tle);
560 need_projection =
true;
630 Assert(whichrel >= 0 && whichrel < mtstate->mt_nrels);
782 resultRelInfo = partRelInfo;
793 if (resultRelationDesc->
rd_rel->relhasindex &&
846 bool flushed =
false;
864 if (resultRelInfo->
ri_Slots == NULL)
1005 if (resultRelationDesc->
rd_rel->relispartition &&
1017 List *arbiterIndexes;
1036 specConflict =
false;
1038 &conflictTid, arbiterIndexes))
1052 &conflictTid, slot, canSetTag,
1099 slot, estate,
false,
true,
1106 specToken, !specConflict);
1140 slot, estate,
false,
1172 ar_insert_trig_tcs = NULL;
1177 ar_insert_trig_tcs);
1201 *inserted_tuple = slot;
1203 *insert_destrel = resultRelInfo;
1226 int numInserted = numSlots;
1239 for (
i = 0;
i < numInserted;
i++)
1261 if (canSetTag && numInserted > 0)
1265 for (
i = 0;
i < numSlots;
i++)
1326 resultRelInfo, tupleid, oldtuple,
1327 epqreturnslot, result, &context->
tmfd);
1390 ar_delete_trig_tcs = NULL;
1395 ar_delete_trig_tcs, changingPart);
1425 bool processReturning,
1437 *tupleDeleted =
false;
1444 epqreturnslot, NULL))
1453 Assert(oldtuple != NULL);
1497 result =
ExecDeleteAct(context, resultRelInfo, tupleid, changingPart);
1529 (
errcode(ERRCODE_TRIGGERED_DATA_CHANGE_VIOLATION),
1530 errmsg(
"tuple to be deleted was already modified by an operation triggered by the current command"),
1531 errhint(
"Consider using an AFTER trigger instead of a BEFORE trigger to propagate changes to other rows.")));
1547 errmsg(
"could not serialize access due to concurrent update")));
1582 *epqreturnslot = epqslot;
1603 (
errcode(ERRCODE_TRIGGERED_DATA_CHANGE_VIOLATION),
1604 errmsg(
"tuple to be deleted was already modified by an operation triggered by the current command"),
1605 errhint(
"Consider using an AFTER trigger instead of a BEFORE trigger to propagate changes to other rows.")));
1624 elog(
ERROR,
"unexpected table_tuple_lock status: %u",
1637 errmsg(
"could not serialize access due to concurrent delete")));
1642 elog(
ERROR,
"unrecognized table_tuple_delete status: %u",
1662 *tupleDeleted =
true;
1683 if (oldtuple != NULL)
1691 elog(
ERROR,
"failed to fetch deleted tuple for DELETE RETURNING");
1757 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1758 errmsg(
"invalid ON UPDATE specification"),
1759 errdetail(
"The result tuple would appear in a different partition than the original tuple.")));
1800 &tuple_deleted, &epqslot);
1848 elog(
ERROR,
"failed to fetch tuple being updated");
1862 if (tupconv_map != NULL)
1870 inserted_tuple, insert_destrel);
1906 if (resultRelationDesc->
rd_rel->relhasindex &&
1919 resultRelInfo, tupleid, oldtuple, slot,
1920 result, &context->
tmfd);
1974 bool partition_constraint_failed;
1999 partition_constraint_failed =
2000 resultRelationDesc->
rd_rel->relispartition &&
2004 if (!partition_constraint_failed &&
2012 resultRelInfo, slot, estate);
2019 if (partition_constraint_failed)
2032 tupleid, oldtuple, slot,
2033 canSetTag, updateCxt,
2056 if (insert_destrel &&
2108 if (result ==
TM_Ok)
2139 tupleid, oldtuple, slot,
2189 foreach(lc, ancestorRels)
2193 bool has_noncloned_fkey =
false;
2196 if (rInfo == rootRelInfo)
2208 has_noncloned_fkey =
true;
2214 if (has_noncloned_fkey)
2216 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2217 errmsg(
"cannot move tuple across partitions when a non-root ancestor of the source partition is directly referenced in a foreign key"),
2218 errdetail(
"A foreign key points to ancestor \"%s\" but not the root ancestor \"%s\".",
2221 errhint(
"Consider defining the foreign key on table \"%s\".",
2227 rootRelInfo, sourcePartInfo, destPartInfo,
2228 tupleid, NULL, newslot,
NIL, NULL,
true);
2272 elog(
ERROR,
"cannot UPDATE during bootstrap");
2322 result =
ExecUpdateAct(context, resultRelInfo, tupleid, oldtuple, slot,
2323 canSetTag, &updateCxt);
2362 (
errcode(ERRCODE_TRIGGERED_DATA_CHANGE_VIOLATION),
2363 errmsg(
"tuple to be updated was already modified by an operation triggered by the current command"),
2364 errhint(
"Consider using an AFTER trigger instead of a BEFORE trigger to propagate changes to other rows.")));
2381 errmsg(
"could not serialize access due to concurrent update")));
2421 elog(
ERROR,
"failed to fetch tuple being updated");
2445 (
errcode(ERRCODE_TRIGGERED_DATA_CHANGE_VIOLATION),
2446 errmsg(
"tuple to be updated was already modified by an operation triggered by the current command"),
2447 errhint(
"Consider using an AFTER trigger instead of a BEFORE trigger to propagate changes to other rows.")));
2452 elog(
ERROR,
"unexpected table_tuple_lock status: %u",
2464 errmsg(
"could not serialize access due to concurrent delete")));
2469 elog(
ERROR,
"unrecognized table_tuple_update status: %u",
2565 (
errcode(ERRCODE_CARDINALITY_VIOLATION),
2567 errmsg(
"%s command cannot affect row a second time",
2568 "ON CONFLICT DO UPDATE"),
2569 errhint(
"Ensure that no rows proposed for insertion within the same command have duplicate constrained values.")));
2572 elog(
ERROR,
"attempted to lock invisible tuple");
2582 elog(
ERROR,
"unexpected self-updated tuple");
2589 errmsg(
"could not serialize access due to concurrent update")));
2613 errmsg(
"could not serialize access due to concurrent delete")));
2621 elog(
ERROR,
"unrecognized table_tuple_lock status: %u",
test);
2652 if (!
ExecQual(onConflictSetWhere, econtext))
2694 *returning =
ExecUpdate(context, resultRelInfo,
2760 matched = tupleid != NULL;
2840 elog(
ERROR,
"failed to fetch the target tuple");
2881 switch (commandType)
2894 tupleid, NULL, newslot, &result))
2896 if (result ==
TM_Ok)
2900 result =
ExecUpdateAct(context, resultRelInfo, tupleid, NULL,
2901 newslot,
false, &updateCxt);
2921 tupleid, NULL, newslot);
2929 NULL, NULL, &result))
2931 if (result ==
TM_Ok)
2935 result =
ExecDeleteAct(context, resultRelInfo, tupleid,
false);
2936 if (result ==
TM_Ok)
2950 elog(
ERROR,
"unknown action in MERGE WHEN MATCHED clause");
2969 (
errcode(ERRCODE_CARDINALITY_VIOLATION),
2971 errmsg(
"%s command cannot affect row a second time",
2973 errhint(
"Ensure that not more than one source row matches any one target row.")));
2975 elog(
ERROR,
"attempted to update or delete invisible tuple");
2982 errmsg(
"could not serialize access due to concurrent delete")));
3054 errmsg(
"tuple to be deleted was already moved to another partition due to concurrent update")));
3067 goto lmerge_matched;
3092 (
errcode(ERRCODE_TRIGGERED_DATA_CHANGE_VIOLATION),
3093 errmsg(
"tuple to be updated or deleted was already modified by an operation triggered by the current command"),
3094 errhint(
"Consider using an AFTER trigger instead of a BEFORE trigger to propagate changes to other rows.")));
3099 elog(
ERROR,
"unexpected table_tuple_lock status: %u",
3109 elog(
ERROR,
"unexpected tuple operation result: %d", result);
3158 foreach(l, actionStates)
3175 switch (commandType)
3188 canSetTag, NULL, NULL);
3195 elog(
ERROR,
"unknown action in MERGE WHEN NOT MATCHED clause");
3247 if (
unlikely(!resultRelInfo->ri_projectNewInfoValid))
3250 foreach(l, mergeActionList)
3273 list = &resultRelInfo->ri_matchedMergeAction;
3275 list = &resultRelInfo->ri_notMatchedMergeAction;
3278 switch (
action->commandType)
3295 if (rootRelInfo->ri_RelationDesc->rd_rel->relkind ==
3296 RELKIND_PARTITIONED_TABLE)
3313 rootRelInfo->ri_RelationDesc);
3321 tgtslot = resultRelInfo->ri_newTupleSlot;
3340 resultRelInfo->ri_newTupleSlot,
3523 bool has_before_insert_row_trig;
3525 has_before_insert_row_trig = (partrel->
ri_TrigDesc &&
3529 !has_before_insert_row_trig ? slot : NULL;
3543 *partRelInfo = partrel;
3582 elog(
ERROR,
"ModifyTable should not be called during EvalPlanQual");
3720 if (relkind == RELKIND_RELATION ||
3721 relkind == RELKIND_MATVIEW ||
3722 relkind == RELKIND_PARTITIONED_TABLE)
3752 tuple_ctid = *tupleid;
3753 tupleid = &tuple_ctid;
3790 oldtuple = &oldtupdata;
3795 Assert(relkind == RELKIND_FOREIGN_TABLE);
3806 slot =
ExecInsert(&context, resultRelInfo, slot,
3820 if (oldtuple != NULL)
3833 elog(
ERROR,
"failed to fetch tuple being updated");
3840 slot =
ExecUpdate(&context, resultRelInfo, tupleid, oldtuple,
3845 slot =
ExecDelete(&context, resultRelInfo, tupleid, oldtuple,
3846 true,
false, node->
canSetTag, NULL, NULL);
3894 bool missing_ok,
bool update_cache)
3916 for (
int ndx = 0; ndx < node->
mt_nrels; ndx++)
3933 elog(
ERROR,
"incorrect result relation OID %u", resultoid);
4063 for (
i = 0;
i < nrels;
i++)
4093 if (relkind == RELKIND_RELATION ||
4094 relkind == RELKIND_MATVIEW ||
4095 relkind == RELKIND_PARTITIONED_TABLE)
4100 elog(
ERROR,
"could not find junk ctid column");
4102 else if (relkind == RELKIND_FOREIGN_TABLE)
4121 elog(
ERROR,
"could not find junk wholerow column");
4132 elog(
ERROR,
"could not find junk wholerow column");
4158 if (rel->
rd_rel->relkind == RELKIND_PARTITIONED_TABLE &&
4173 foreach(ll, wcoList)
4179 wcoExprs =
lappend(wcoExprs, wcoExpr);
4322 arowmarks =
lappend(arowmarks, aerm);
4339 #ifdef USE_ASSERT_CHECKING
4340 #define MT_NRELS_HASH 4
4342 #define MT_NRELS_HASH 64
4355 for (
i = 0;
i < nrels;
i++)
4484 elog(
ERROR,
"ExecReScanModifyTable is not implemented");
#define AttributeNumberIsValid(attributeNumber)
bool bms_is_member(int x, const Bitmapset *a)
Bitmapset * bms_add_member(Bitmapset *a, int x)
bool bms_overlap(const Bitmapset *a, const Bitmapset *b)
static Datum values[MAXATTR]
Datum datumCopy(Datum value, bool typByVal, int typLen)
elog(ERROR, "%s: %s", p2, msg)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)
int errdetail(const char *fmt,...)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
ExprState * ExecPrepareExpr(Expr *node, EState *estate)
ProjectionInfo * ExecBuildUpdateProjection(List *targetList, bool evalTargetList, List *targetColnos, TupleDesc relDesc, ExprContext *econtext, TupleTableSlot *slot, PlanState *parent)
ExprState * ExecInitQual(List *qual, PlanState *parent)
ProjectionInfo * ExecBuildProjectionInfo(List *targetList, ExprContext *econtext, TupleTableSlot *slot, PlanState *parent, TupleDesc inputDesc)
bool ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, ItemPointer conflictTid, List *arbiterIndexes)
List * ExecInsertIndexTuples(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, bool update, bool noDupErr, bool *specConflict, List *arbiterIndexes, bool onlySummarizing)
void ExecOpenIndices(ResultRelInfo *resultRelInfo, bool speculative)
AttrNumber ExecFindJunkAttributeInTlist(List *targetlist, const char *attrName)
LockTupleMode ExecUpdateLockMode(EState *estate, ResultRelInfo *relinfo)
void EvalPlanQualBegin(EPQState *epqstate)
TupleTableSlot * EvalPlanQual(EPQState *epqstate, Relation relation, Index rti, TupleTableSlot *inputslot)
bool ExecPartitionCheck(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, bool emitError)
void EvalPlanQualInit(EPQState *epqstate, EState *parentestate, Plan *subplan, List *auxrowmarks, int epqParam, List *resultRelations)
void ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
ExecAuxRowMark * ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist)
void EvalPlanQualEnd(EPQState *epqstate)
void EvalPlanQualSetPlan(EPQState *epqstate, Plan *subplan, List *auxrowmarks)
ExecRowMark * ExecFindRowMark(EState *estate, Index rti, bool missing_ok)
List * ExecGetAncestorResultRels(EState *estate, ResultRelInfo *resultRelInfo)
TupleTableSlot * EvalPlanQualSlot(EPQState *epqstate, Relation relation, Index rti)
void ExecPartitionCheckEmitError(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
void ExecConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
void CheckValidResultRel(ResultRelInfo *resultRelInfo, CmdType operation)
ResultRelInfo * ExecFindPartition(ModifyTableState *mtstate, ResultRelInfo *rootResultRelInfo, PartitionTupleRouting *proute, TupleTableSlot *slot, EState *estate)
PartitionTupleRouting * ExecSetupPartitionTupleRouting(EState *estate, Relation rel)
void ExecCleanupTupleRouting(ModifyTableState *mtstate, PartitionTupleRouting *proute)
void ExecEndNode(PlanState *node)
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
const TupleTableSlotOps TTSOpsVirtual
TupleTableSlot * ExecStoreVirtualTuple(TupleTableSlot *slot)
void ExecDropSingleTupleTableSlot(TupleTableSlot *slot)
TupleTableSlot * ExecStoreAllNullTuple(TupleTableSlot *slot)
void ExecInitResultTypeTL(PlanState *planstate)
void ExecInitResultTupleSlotTL(PlanState *planstate, const TupleTableSlotOps *tts_ops)
TupleTableSlot * MakeSingleTupleTableSlot(TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)
void ExecForceStoreHeapTuple(HeapTuple tuple, TupleTableSlot *slot, bool shouldFree)
Bitmapset * ExecGetUpdatedCols(ResultRelInfo *relinfo, EState *estate)
TupleTableSlot * ExecGetReturningSlot(EState *estate, ResultRelInfo *relInfo)
void ExecInitResultRelation(EState *estate, ResultRelInfo *resultRelInfo, Index rti)
void ExecAssignExprContext(EState *estate, PlanState *planstate)
TupleConversionMap * ExecGetRootToChildMap(ResultRelInfo *resultRelInfo, EState *estate)
TupleConversionMap * ExecGetChildToRootMap(ResultRelInfo *resultRelInfo)
#define InstrCountFiltered1(node, delta)
#define outerPlanState(node)
#define InstrCountTuples2(node, delta)
#define EXEC_FLAG_BACKWARD
#define ResetPerTupleExprContext(estate)
#define GetPerTupleExprContext(estate)
static TupleTableSlot * ExecProject(ProjectionInfo *projInfo)
#define ResetExprContext(econtext)
#define GetPerTupleMemoryContext(estate)
static bool ExecQual(ExprState *state, ExprContext *econtext)
#define EvalPlanQualSetSlot(epqstate, slot)
static Datum ExecEvalExpr(ExprState *state, ExprContext *econtext, bool *isNull)
#define EXEC_FLAG_EXPLAIN_ONLY
static Datum ExecGetJunkAttribute(TupleTableSlot *slot, AttrNumber attno, bool *isNull)
static TupleTableSlot * ExecProcNode(PlanState *node)
#define DatumGetHeapTupleHeader(X)
#define HeapTupleHeaderGetDatumLength(tup)
if(TABLE==NULL||TABLE_index==NULL)
static void ItemPointerSetInvalid(ItemPointerData *pointer)
static bool ItemPointerIndicatesMovedPartitions(const ItemPointerData *pointer)
ItemPointerData * ItemPointer
static void ItemPointerCopy(const ItemPointerData *fromPointer, ItemPointerData *toPointer)
Assert(fmt[strlen(fmt) - 1] !='\n')
List * lappend(List *list, void *datum)
bool list_member_ptr(const List *list, const void *datum)
void list_free(List *list)
List * lcons(void *datum, List *list)
uint32 SpeculativeInsertionLockAcquire(TransactionId xid)
void SpeculativeInsertionLockRelease(TransactionId xid)
void * palloc0(Size size)
MemoryContext CurrentMemoryContext
#define IsBootstrapProcessingMode()
#define CHECK_FOR_INTERRUPTS()
Oid exprType(const Node *expr)
static void ExecInitInsertProjection(ModifyTableState *mtstate, ResultRelInfo *resultRelInfo)
static void ExecPendingInserts(EState *estate)
static void ExecSetupTransitionCaptureState(ModifyTableState *mtstate, EState *estate)
void ExecInitMergeTupleSlots(ModifyTableState *mtstate, ResultRelInfo *resultRelInfo)
static TupleTableSlot * ExecMerge(ModifyTableContext *context, ResultRelInfo *resultRelInfo, ItemPointer tupleid, bool canSetTag)
struct ModifyTableContext ModifyTableContext
static void ExecUpdatePrepareSlot(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
static TupleTableSlot * ExecInsert(ModifyTableContext *context, ResultRelInfo *resultRelInfo, TupleTableSlot *slot, bool canSetTag, TupleTableSlot **inserted_tuple, ResultRelInfo **insert_destrel)
void ExecInitStoredGenerated(ResultRelInfo *resultRelInfo, EState *estate, CmdType cmdtype)
static void ExecMergeNotMatched(ModifyTableContext *context, ResultRelInfo *resultRelInfo, bool canSetTag)
static bool ExecDeletePrologue(ModifyTableContext *context, ResultRelInfo *resultRelInfo, ItemPointer tupleid, HeapTuple oldtuple, TupleTableSlot **epqreturnslot, TM_Result *result)
static void ExecCheckPlanOutput(Relation resultRel, List *targetList)
static TupleTableSlot * ExecModifyTable(PlanState *pstate)
static void ExecCrossPartitionUpdateForeignKey(ModifyTableContext *context, ResultRelInfo *sourcePartInfo, ResultRelInfo *destPartInfo, ItemPointer tupleid, TupleTableSlot *oldslot, TupleTableSlot *newslot)
TupleTableSlot * ExecGetUpdateNewTuple(ResultRelInfo *relinfo, TupleTableSlot *planSlot, TupleTableSlot *oldSlot)
static void ExecInitUpdateProjection(ModifyTableState *mtstate, ResultRelInfo *resultRelInfo)
static void ExecCheckTIDVisible(EState *estate, ResultRelInfo *relinfo, ItemPointer tid, TupleTableSlot *tempSlot)
static TM_Result ExecDeleteAct(ModifyTableContext *context, ResultRelInfo *resultRelInfo, ItemPointer tupleid, bool changingPart)
static void ExecCheckTupleVisible(EState *estate, Relation rel, TupleTableSlot *slot)
static TupleTableSlot * ExecGetInsertNewTuple(ResultRelInfo *relinfo, TupleTableSlot *planSlot)
void ExecComputeStoredGenerated(ResultRelInfo *resultRelInfo, EState *estate, TupleTableSlot *slot, CmdType cmdtype)
static TupleTableSlot * ExecPrepareTupleRouting(ModifyTableState *mtstate, EState *estate, PartitionTupleRouting *proute, ResultRelInfo *targetRelInfo, TupleTableSlot *slot, ResultRelInfo **partRelInfo)
struct MTTargetRelLookup MTTargetRelLookup
static TupleTableSlot * ExecUpdate(ModifyTableContext *context, ResultRelInfo *resultRelInfo, ItemPointer tupleid, HeapTuple oldtuple, TupleTableSlot *slot, bool canSetTag)
ResultRelInfo * ExecLookupResultRelByOid(ModifyTableState *node, Oid resultoid, bool missing_ok, bool update_cache)
struct UpdateContext UpdateContext
static TM_Result ExecUpdateAct(ModifyTableContext *context, ResultRelInfo *resultRelInfo, ItemPointer tupleid, HeapTuple oldtuple, TupleTableSlot *slot, bool canSetTag, UpdateContext *updateCxt)
static void ExecUpdateEpilogue(ModifyTableContext *context, UpdateContext *updateCxt, ResultRelInfo *resultRelInfo, ItemPointer tupleid, HeapTuple oldtuple, TupleTableSlot *slot)
static bool ExecCrossPartitionUpdate(ModifyTableContext *context, ResultRelInfo *resultRelInfo, ItemPointer tupleid, HeapTuple oldtuple, TupleTableSlot *slot, bool canSetTag, UpdateContext *updateCxt, TupleTableSlot **retry_slot, TupleTableSlot **inserted_tuple, ResultRelInfo **insert_destrel)
static void fireBSTriggers(ModifyTableState *node)
static TupleTableSlot * ExecProcessReturning(ResultRelInfo *resultRelInfo, TupleTableSlot *tupleSlot, TupleTableSlot *planSlot)
void ExecReScanModifyTable(ModifyTableState *node)
void ExecEndModifyTable(ModifyTableState *node)
ModifyTableState * ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
static void fireASTriggers(ModifyTableState *node)
static bool ExecOnConflictUpdate(ModifyTableContext *context, ResultRelInfo *resultRelInfo, ItemPointer conflictTid, TupleTableSlot *excludedSlot, bool canSetTag, TupleTableSlot **returning)
static void ExecBatchInsert(ModifyTableState *mtstate, ResultRelInfo *resultRelInfo, TupleTableSlot **slots, TupleTableSlot **planSlots, int numSlots, EState *estate, bool canSetTag)
static bool ExecUpdatePrologue(ModifyTableContext *context, ResultRelInfo *resultRelInfo, ItemPointer tupleid, HeapTuple oldtuple, TupleTableSlot *slot, TM_Result *result)
static void ExecDeleteEpilogue(ModifyTableContext *context, ResultRelInfo *resultRelInfo, ItemPointer tupleid, HeapTuple oldtuple, bool changingPart)
static bool ExecMergeMatched(ModifyTableContext *context, ResultRelInfo *resultRelInfo, ItemPointer tupleid, bool canSetTag)
static void ExecInitMerge(ModifyTableState *mtstate, EState *estate)
static TupleTableSlot * ExecDelete(ModifyTableContext *context, ResultRelInfo *resultRelInfo, ItemPointer tupleid, HeapTuple oldtuple, bool processReturning, bool changingPart, bool canSetTag, bool *tupleDeleted, TupleTableSlot **epqreturnslot)
#define IsA(nodeptr, _type_)
#define castNode(_type_, nodeptr)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
@ WCO_RLS_MERGE_UPDATE_CHECK
@ WCO_RLS_MERGE_DELETE_CHECK
FormData_pg_attribute * Form_pg_attribute
#define lfirst_node(type, lc)
static int list_length(const List *l)
#define forboth(cell1, list1, cell2, list2)
static void * list_nth(const List *list, int n)
#define ERRCODE_T_R_SERIALIZATION_FAILURE
static Oid DatumGetObjectId(Datum X)
static Pointer DatumGetPointer(Datum X)
static TransactionId DatumGetTransactionId(Datum X)
#define RelationGetRelid(relation)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
Node * build_column_default(Relation rel, int attrno)
int RI_FKey_trigger_type(Oid tgfoid)
List * es_insert_pending_result_relations
MemoryContext es_query_cxt
struct EPQState * es_epq_active
List * es_insert_pending_modifytables
List * es_auxmodifytables
Snapshot es_crosscheck_snapshot
TupleTableSlot * ecxt_innertuple
TupleTableSlot * ecxt_scantuple
TupleTableSlot * ecxt_outertuple
BeginForeignModify_function BeginForeignModify
EndForeignModify_function EndForeignModify
ExecForeignInsert_function ExecForeignInsert
ExecForeignUpdate_function ExecForeignUpdate
ExecForeignBatchInsert_function ExecForeignBatchInsert
GetForeignModifyBatchSize_function GetForeignModifyBatchSize
ExecForeignDelete_function ExecForeignDelete
ProjectionInfo * mas_proj
MergeActionState * relaction
TupleTableSlot * planSlot
TupleTableSlot * cpUpdateReturningSlot
ModifyTableState * mtstate
ResultRelInfo * resultRelInfo
struct PartitionTupleRouting * mt_partition_tuple_routing
TupleTableSlot * mt_root_tuple_slot
ResultRelInfo * rootResultRelInfo
struct TransitionCaptureState * mt_transition_capture
struct TransitionCaptureState * mt_oc_transition_capture
Bitmapset * fdwDirectModifyPlans
List * withCheckOptionLists
OnConflictAction onConflictAction
TupleTableSlot * oc_ProjSlot
TupleTableSlot * oc_Existing
ExprState * oc_WhereClause
ProjectionInfo * oc_ProjInfo
ExprContext * ps_ExprContext
TupleTableSlot * ps_ResultTupleSlot
ExecProcNodeMtd ExecProcNode
ExprContext * pi_exprContext
List * ri_matchedMergeAction
TupleTableSlot * ri_PartitionTupleSlot
List * ri_notMatchedMergeAction
bool ri_projectNewInfoValid
OnConflictSetState * ri_onConflict
List * ri_onConflictArbiterIndexes
struct ResultRelInfo * ri_RootResultRelInfo
TupleTableSlot ** ri_Slots
RelationPtr ri_IndexRelationDescs
int ri_NumSlotsInitialized
List * ri_WithCheckOptions
TupleTableSlot * ri_oldTupleSlot
TriggerDesc * ri_TrigDesc
Bitmapset * ri_extraUpdatedCols
ExprState ** ri_GeneratedExprsI
int ri_NumGeneratedNeededU
TupleTableSlot * ri_newTupleSlot
List * ri_WithCheckOptionExprs
ProjectionInfo * ri_projectNew
ProjectionInfo * ri_projectReturning
ExprState ** ri_GeneratedExprsU
struct FdwRoutine * ri_FdwRoutine
TupleTableSlot ** ri_PlanSlots
bool ri_usesFdwDirectModify
int ri_NumGeneratedNeededI
TupleTableSlot * tcs_original_insert_tuple
bool tcs_update_new_table
bool tcs_update_old_table
bool trig_delete_before_row
bool trig_update_instead_row
bool trig_delete_instead_row
bool trig_update_after_row
bool trig_insert_instead_row
bool trig_update_before_row
bool trig_insert_before_row
bool has_generated_stored
TupleDesc tts_tupleDescriptor
const TupleTableSlotOps *const tts_ops
TU_UpdateIndexes updateIndexes
#define MinTransactionIdAttributeNumber
#define FirstLowInvalidHeapAttributeNumber
TupleTableSlot * table_slot_create(Relation relation, List **reglist)
static TM_Result table_tuple_lock(Relation rel, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, CommandId cid, LockTupleMode mode, LockWaitPolicy wait_policy, uint8 flags, TM_FailureData *tmfd)
static void table_tuple_complete_speculative(Relation rel, TupleTableSlot *slot, uint32 specToken, bool succeeded)
static TM_Result table_tuple_update(Relation rel, ItemPointer otid, TupleTableSlot *slot, CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, LockTupleMode *lockmode, TU_UpdateIndexes *update_indexes)
static TM_Result table_tuple_delete(Relation rel, ItemPointer tid, CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, bool changingPart)
#define TUPLE_LOCK_FLAG_FIND_LAST_VERSION
static void table_tuple_insert(Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate)
static void table_tuple_insert_speculative(Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate, uint32 specToken)
static bool table_tuple_satisfies_snapshot(Relation rel, TupleTableSlot *slot, Snapshot snapshot)
static bool table_tuple_fetch_row_version(Relation rel, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot)
bool ExecBRUpdateTriggers(EState *estate, EPQState *epqstate, ResultRelInfo *relinfo, ItemPointer tupleid, HeapTuple fdw_trigtuple, TupleTableSlot *newslot, TM_Result *tmresult, TM_FailureData *tmfd)
void ExecARDeleteTriggers(EState *estate, ResultRelInfo *relinfo, ItemPointer tupleid, HeapTuple fdw_trigtuple, TransitionCaptureState *transition_capture, bool is_crosspart_update)
void ExecBSInsertTriggers(EState *estate, ResultRelInfo *relinfo)
bool ExecBRInsertTriggers(EState *estate, ResultRelInfo *relinfo, TupleTableSlot *slot)
bool ExecIRDeleteTriggers(EState *estate, ResultRelInfo *relinfo, HeapTuple trigtuple)
void ExecBSDeleteTriggers(EState *estate, ResultRelInfo *relinfo)
bool ExecIRInsertTriggers(EState *estate, ResultRelInfo *relinfo, TupleTableSlot *slot)
void ExecARUpdateTriggers(EState *estate, ResultRelInfo *relinfo, ResultRelInfo *src_partinfo, ResultRelInfo *dst_partinfo, ItemPointer tupleid, HeapTuple fdw_trigtuple, TupleTableSlot *newslot, List *recheckIndexes, TransitionCaptureState *transition_capture, bool is_crosspart_update)
void ExecASUpdateTriggers(EState *estate, ResultRelInfo *relinfo, TransitionCaptureState *transition_capture)
void ExecASDeleteTriggers(EState *estate, ResultRelInfo *relinfo, TransitionCaptureState *transition_capture)
bool ExecBRDeleteTriggers(EState *estate, EPQState *epqstate, ResultRelInfo *relinfo, ItemPointer tupleid, HeapTuple fdw_trigtuple, TupleTableSlot **epqslot, TM_Result *tmresult, TM_FailureData *tmfd)
void ExecARInsertTriggers(EState *estate, ResultRelInfo *relinfo, TupleTableSlot *slot, List *recheckIndexes, TransitionCaptureState *transition_capture)
TransitionCaptureState * MakeTransitionCaptureState(TriggerDesc *trigdesc, Oid relid, CmdType cmdType)
void ExecASInsertTriggers(EState *estate, ResultRelInfo *relinfo, TransitionCaptureState *transition_capture)
bool ExecIRUpdateTriggers(EState *estate, ResultRelInfo *relinfo, HeapTuple trigtuple, TupleTableSlot *newslot)
void ExecBSUpdateTriggers(EState *estate, ResultRelInfo *relinfo)
TupleTableSlot * execute_attr_map_slot(AttrMap *attrMap, TupleTableSlot *in_slot, TupleTableSlot *out_slot)
TupleDesc CreateTupleDescCopy(TupleDesc tupdesc)
#define TupleDescAttr(tupdesc, i)
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
static TupleTableSlot * ExecCopySlot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
static Datum slot_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
static void slot_getallattrs(TupleTableSlot *slot)
static void ExecMaterializeSlot(TupleTableSlot *slot)
void pull_varattnos(Node *node, Index varno, Bitmapset **varattnos)
bool TransactionIdIsCurrentTransactionId(TransactionId xid)
TransactionId GetCurrentTransactionId(void)
#define IsolationUsesXactSnapshot()