68 Anum_pg_index_indclass);
79 int table_attno = indkey->
values[index_attoff];
101 elog(
ERROR,
"missing operator %d(%u,%u) in opfamily %u",
148 bool isIdxSafeToSkipDuplicates;
175 if (!isIdxSafeToSkipDuplicates)
179 #ifdef USE_ASSERT_CHECKING
240 errmsg(
"tuple to be locked was already moved to another partition due to concurrent update, retrying")));
244 errmsg(
"concurrent update, retrying")));
250 errmsg(
"concurrent delete, retrying")));
253 elog(
ERROR,
"attempted to lock invisible tuple");
256 elog(
ERROR,
"unexpected table_tuple_lock status: %u",
res);
296 if (att->attisdropped || att->attgenerated)
312 typentry = eq[attrnum];
313 if (typentry == NULL)
319 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
320 errmsg(
"could not identify an equality operator for type %s",
322 eq[attrnum] = typentry;
424 errmsg(
"tuple to be locked was already moved to another partition due to concurrent update, retrying")));
428 errmsg(
"concurrent update, retrying")));
434 errmsg(
"concurrent delete, retrying")));
437 elog(
ERROR,
"attempted to lock invisible tuple");
440 elog(
ERROR,
"unexpected table_tuple_lock status: %u",
res);
461 bool skip_tuple =
false;
490 if (rel->
rd_rel->relispartition)
498 slot, estate,
false,
false,
503 recheckIndexes, NULL);
526 bool skip_tuple =
false;
540 tid, NULL, slot, NULL, NULL))
558 if (rel->
rd_rel->relispartition)
566 slot, estate,
true,
false,
574 recheckIndexes, NULL,
false);
591 bool skip_tuple =
false;
602 tid, NULL, NULL, NULL, NULL);
612 tid, NULL, NULL,
false);
628 if (rel->
rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
650 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
651 errmsg(
"cannot update table \"%s\"",
653 errdetail(
"Column used in the publication WHERE expression is not part of the replica identity.")));
656 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
657 errmsg(
"cannot update table \"%s\"",
659 errdetail(
"Column list used by the publication does not cover the replica identity.")));
662 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
663 errmsg(
"cannot delete from table \"%s\"",
665 errdetail(
"Column used in the publication WHERE expression is not part of the replica identity.")));
668 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
669 errmsg(
"cannot delete from table \"%s\"",
671 errdetail(
"Column list used by the publication does not cover the replica identity.")));
678 if (rel->
rd_rel->relreplident == REPLICA_IDENTITY_FULL)
688 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
689 errmsg(
"cannot update table \"%s\" because it does not have a replica identity and publishes updates",
691 errhint(
"To enable updating the table, set REPLICA IDENTITY using ALTER TABLE.")));
694 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
695 errmsg(
"cannot delete from table \"%s\" because it does not have a replica identity and publishes deletes",
697 errhint(
"To enable deleting from the table, set REPLICA IDENTITY using ALTER TABLE.")));
710 if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE)
712 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
713 errmsg(
"cannot use relation \"%s.%s\" as logical replication target",
#define AttributeNumberIsValid(attributeNumber)
#define PG_USED_FOR_ASSERTS_ONLY
#define OidIsValid(objectId)
static void PGresult * res
elog(ERROR, "%s: %s", p2, msg)
int errdetail(const char *fmt,...)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
List * ExecInsertIndexTuples(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, bool update, bool noDupErr, bool *specConflict, List *arbiterIndexes, bool onlySummarizing)
bool ExecPartitionCheck(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, bool emitError)
void ExecConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
bool RelationFindReplTupleSeq(Relation rel, LockTupleMode lockmode, TupleTableSlot *searchslot, TupleTableSlot *outslot)
bool RelationFindReplTupleByIndex(Relation rel, Oid idxoid, LockTupleMode lockmode, TupleTableSlot *searchslot, TupleTableSlot *outslot)
void ExecSimpleRelationDelete(ResultRelInfo *resultRelInfo, EState *estate, EPQState *epqstate, TupleTableSlot *searchslot)
void CheckSubscriptionRelkind(char relkind, const char *nspname, const char *relname)
static bool tuples_equal(TupleTableSlot *slot1, TupleTableSlot *slot2, TypeCacheEntry **eq)
void ExecSimpleRelationUpdate(ResultRelInfo *resultRelInfo, EState *estate, EPQState *epqstate, TupleTableSlot *searchslot, TupleTableSlot *slot)
void CheckCmdReplicaIdentity(Relation rel, CmdType cmd)
void ExecSimpleRelationInsert(ResultRelInfo *resultRelInfo, EState *estate, TupleTableSlot *slot)
static int build_replindex_scan_key(ScanKey skey, Relation rel, Relation idxrel, TupleTableSlot *searchslot)
void ExecDropSingleTupleTableSlot(TupleTableSlot *slot)
Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)
IndexInfo * BuildIndexInfo(Relation index)
bool index_getnext_slot(IndexScanDesc scan, ScanDirection direction, TupleTableSlot *slot)
void index_close(Relation relation, LOCKMODE lockmode)
IndexScanDesc index_beginscan(Relation heapRelation, Relation indexRelation, Snapshot snapshot, int nkeys, int norderbys)
void index_endscan(IndexScanDesc scan)
Relation index_open(Oid relationId, LOCKMODE lockmode)
void index_rescan(IndexScanDesc scan, ScanKey keys, int nkeys, ScanKey orderbys, int norderbys)
static bool ItemPointerIndicatesMovedPartitions(const ItemPointerData *pointer)
Assert(fmt[strlen(fmt) - 1] !='\n')
void list_free(List *list)
void XactLockTableWait(TransactionId xid, Relation rel, ItemPointer ctid, XLTW_Oper oper)
Oid get_opclass_input_type(Oid opclass)
Oid get_opclass_family(Oid opclass)
RegProcedure get_opcode(Oid opno)
Oid get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype, int16 strategy)
void * palloc0(Size size)
void ExecComputeStoredGenerated(ResultRelInfo *resultRelInfo, EState *estate, TupleTableSlot *slot, CmdType cmdtype)
FormData_pg_attribute * Form_pg_attribute
int errdetail_relkind_not_supported(char relkind)
#define ERRCODE_T_R_SERIALIZATION_FAILURE
static bool DatumGetBool(Datum X)
static Pointer DatumGetPointer(Datum X)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
#define IndexRelationGetNumberOfKeyAttributes(relation)
void RelationBuildPublicationDesc(Relation relation, PublicationDesc *pubdesc)
Oid RelationGetReplicaIndex(Relation relation)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
Snapshot GetLatestSnapshot(void)
void PushActiveSnapshot(Snapshot snapshot)
void PopActiveSnapshot(void)
#define InitDirtySnapshot(snapshotdata)
Oid GetRelationIdentityOrPK(Relation rel)
bool IsIndexUsableForReplicaIdentityFull(IndexInfo *indexInfo)
#define BTEqualStrategyNumber
PublicationActions pubactions
bool cols_valid_for_delete
bool cols_valid_for_update
struct HeapTupleData * rd_indextuple
TriggerDesc * ri_TrigDesc
bool trig_delete_before_row
bool trig_update_before_row
bool trig_insert_before_row
bool has_generated_stored
TupleDesc tts_tupleDescriptor
int16 values[FLEXIBLE_ARRAY_MEMBER]
Oid values[FLEXIBLE_ARRAY_MEMBER]
Datum SysCacheGetAttrNotNull(int cacheId, HeapTuple tup, AttrNumber attributeNumber)
void simple_table_tuple_update(Relation rel, ItemPointer otid, TupleTableSlot *slot, Snapshot snapshot, TU_UpdateIndexes *update_indexes)
void simple_table_tuple_insert(Relation rel, TupleTableSlot *slot)
void simple_table_tuple_delete(Relation rel, ItemPointer tid, Snapshot snapshot)
TupleTableSlot * table_slot_create(Relation relation, List **reglist)
static TableScanDesc table_beginscan(Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key)
static void table_endscan(TableScanDesc scan)
static void table_rescan(TableScanDesc scan, struct ScanKeyData *key)
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 bool table_scan_getnextslot(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
#define TransactionIdIsValid(xid)
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)
bool ExecBRInsertTriggers(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)
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)
bool equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
#define TupleDescAttr(tupdesc, i)
static TupleTableSlot * ExecCopySlot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
static void slot_getallattrs(TupleTableSlot *slot)
static void ExecMaterializeSlot(TupleTableSlot *slot)
TypeCacheEntry * lookup_type_cache(Oid type_id, int flags)
#define TYPECACHE_EQ_OPR_FINFO
CommandId GetCurrentCommandId(bool used)