122 errmsg(
"conflict detected on relation \"%s.%s\": conflict=%s",
127 localslot, remoteslot, indexoid,
128 localxmin, localorigin, localts));
144 if (indexRelation == NULL)
152 if (!indexRelation->
rd_index->indimmediate)
172 return errcode(ERRCODE_UNIQUE_VIOLATION);
217 appendStringInfo(&err_detail,
_(
"Key already exists in unique index \"%s\", modified locally in transaction %u at %s."),
221 appendStringInfo(&err_detail,
_(
"Key already exists in unique index \"%s\", modified by origin \"%s\" in transaction %u at %s."),
233 appendStringInfo(&err_detail,
_(
"Key already exists in unique index \"%s\", modified by a non-existent origin in transaction %u at %s."),
238 appendStringInfo(&err_detail,
_(
"Key already exists in unique index \"%s\", modified in transaction %u."),
245 appendStringInfo(&err_detail,
_(
"Updating the row that was modified locally in transaction %u at %s."),
248 appendStringInfo(&err_detail,
_(
"Updating the row that was modified by a different origin \"%s\" in transaction %u at %s."),
253 appendStringInfo(&err_detail,
_(
"Updating the row that was modified by a non-existent origin in transaction %u at %s."),
264 appendStringInfo(&err_detail,
_(
"Deleting the row that was modified locally in transaction %u at %s."),
267 appendStringInfo(&err_detail,
_(
"Deleting the row that was modified by a different origin \"%s\" in transaction %u at %s."),
272 appendStringInfo(&err_detail,
_(
"Deleting the row that was modified by a non-existent origin in transaction %u at %s."),
285 localslot, remoteslot, indexoid);
318 Assert(searchslot || localslot || remoteslot);
347 if (tuple_value.
len > 0)
379 if (tuple_value.
len > 0)
416 if (tuple_value.
len > 0)
420 ?
_(
"replica identity %s")
421 :
_(
"replica identity full %s"), desc);
426 ?
_(
"Replica identity %s")
427 :
_(
"Replica identity full %s"), desc);
432 if (tuple_value.
len == 0)
436 return tuple_value.
data;
Subscription * MySubscription
const char * timestamptz_to_str(TimestampTz t)
Bitmapset * bms_union(const Bitmapset *a, const Bitmapset *b)
static Datum values[MAXATTR]
#define Assert(condition)
#define OidIsValid(objectId)
bool track_commit_timestamp
bool TransactionIdGetCommitTsData(TransactionId xid, TimestampTz *ts, RepOriginId *nodeid)
static const char *const ConflictTypeNames[]
static char * build_tuple_value_details(EState *estate, ResultRelInfo *relinfo, ConflictType type, TupleTableSlot *searchslot, TupleTableSlot *localslot, TupleTableSlot *remoteslot, Oid indexoid)
static char * build_index_value_desc(EState *estate, Relation localrel, TupleTableSlot *slot, Oid indexoid)
void InitConflictIndexes(ResultRelInfo *relInfo)
static int errcode_apply_conflict(ConflictType type)
static int errdetail_apply_conflict(EState *estate, ResultRelInfo *relinfo, ConflictType type, TupleTableSlot *searchslot, TupleTableSlot *localslot, TupleTableSlot *remoteslot, Oid indexoid, TransactionId localxmin, RepOriginId localorigin, TimestampTz localts)
void ReportApplyConflict(EState *estate, ResultRelInfo *relinfo, int elevel, ConflictType type, TupleTableSlot *searchslot, TupleTableSlot *localslot, TupleTableSlot *remoteslot, Oid indexoid, TransactionId localxmin, RepOriginId localorigin, TimestampTz localts)
bool GetTupleTransactionInfo(TupleTableSlot *localslot, TransactionId *xmin, RepOriginId *localorigin, TimestampTz *localts)
@ CT_UPDATE_ORIGIN_DIFFERS
@ CT_DELETE_ORIGIN_DIFFERS
int errdetail_internal(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
char * ExecBuildSlotValueDescription(Oid reloid, TupleTableSlot *slot, TupleDesc tupdesc, Bitmapset *modifiedCols, int maxfieldlen)
Bitmapset * ExecGetUpdatedCols(ResultRelInfo *relinfo, EState *estate)
Bitmapset * ExecGetInsertedCols(ResultRelInfo *relinfo, EState *estate)
#define GetPerTupleExprContext(estate)
char * BuildIndexValueDescription(Relation indexRelation, const Datum *values, const bool *isnull)
void FormIndexDatum(IndexInfo *indexInfo, TupleTableSlot *slot, EState *estate, Datum *values, bool *isnull)
IndexInfo * BuildIndexInfo(Relation index)
void index_close(Relation relation, LOCKMODE lockmode)
Relation index_open(Oid relationId, LOCKMODE lockmode)
List * lappend_oid(List *list, Oid datum)
bool CheckRelationOidLockedByMe(Oid relid, LOCKMODE lockmode, bool orstronger)
char * get_namespace_name(Oid nspid)
char * get_rel_name(Oid relid)
bool replorigin_by_oid(RepOriginId roident, bool missing_ok, char **roname)
#define InvalidRepOriginId
#define ERRCODE_T_R_SERIALIZATION_FAILURE
void pgstat_report_subscription_conflict(Oid subid, ConflictType type)
static TransactionId DatumGetTransactionId(Datum X)
#define RelationGetRelid(relation)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
#define RelationGetNamespace(relation)
Oid GetRelationIdentityOrPK(Relation rel)
void appendStringInfo(StringInfo str, const char *fmt,...)
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
List * ri_onConflictArbiterIndexes
RelationPtr ri_IndexRelationDescs
IndexInfo ** ri_IndexRelationInfo
#define MinTransactionIdAttributeNumber
TupleTableSlot * table_slot_create(Relation relation, List **reglist)
#define TTS_IS_VIRTUAL(slot)
static TupleTableSlot * ExecCopySlot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
static Datum slot_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)