1 /*-------------------------------------------------------------------------
3 * Exports for conflicts logging.
5 * Copyright (c) 2024-2025, PostgreSQL Global Development Group
7 *-------------------------------------------------------------------------
12 #include "nodes/execnodes.h"
13 #include "utils/timestamp.h"
16 * Conflict types that could occur while applying remote changes.
18 * This enum is used in statistics collection (see
19 * PgStat_StatSubEntry::conflict_count and
20 * PgStat_BackendSubEntry::conflict_count) as well, therefore, when adding new
21 * values or reordering existing ones, ensure to review and potentially adjust
22 * the corresponding statistics collection codes.
26 /* The row to be inserted violates unique constraint */
29 /* The row to be updated was modified by a different origin */
30 CT_UPDATE_ORIGIN_DIFFERS
,
32 /* The updated row value violates unique constraint */
35 /* The row to be updated is missing */
38 /* The row to be deleted was modified by a different origin */
39 CT_DELETE_ORIGIN_DIFFERS
,
41 /* The row to be deleted is missing */
45 * Other conflicts, such as exclusion constraint violations, involve more
46 * complex rules than simple equality checks. These conflicts are left for
47 * future improvements.
51 #define CONFLICT_NUM_TYPES (CT_DELETE_MISSING + 1)
53 extern bool GetTupleTransactionInfo(TupleTableSlot
*localslot
,
55 RepOriginId
*localorigin
,
56 TimestampTz
*localts
);
57 extern void ReportApplyConflict(EState
*estate
, ResultRelInfo
*relinfo
,
58 int elevel
, ConflictType type
,
59 TupleTableSlot
*searchslot
,
60 TupleTableSlot
*localslot
,
61 TupleTableSlot
*remoteslot
,
62 Oid indexoid
, TransactionId localxmin
,
63 RepOriginId localorigin
, TimestampTz localts
);
64 extern void InitConflictIndexes(ResultRelInfo
*relInfo
);