require_auth: prepare for multiple SASL mechanisms
[pgsql.git] / src / include / replication / conflict.h
blob37454dc951372ee4b8c1ca8b74e2bccd59a6547b
1 /*-------------------------------------------------------------------------
2 * conflict.h
3 * Exports for conflicts logging.
5 * Copyright (c) 2024-2025, PostgreSQL Global Development Group
7 *-------------------------------------------------------------------------
8 */
9 #ifndef CONFLICT_H
10 #define CONFLICT_H
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.
24 typedef enum
26 /* The row to be inserted violates unique constraint */
27 CT_INSERT_EXISTS,
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 */
33 CT_UPDATE_EXISTS,
35 /* The row to be updated is missing */
36 CT_UPDATE_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 */
42 CT_DELETE_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.
49 } ConflictType;
51 #define CONFLICT_NUM_TYPES (CT_DELETE_MISSING + 1)
53 extern bool GetTupleTransactionInfo(TupleTableSlot *localslot,
54 TransactionId *xmin,
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);
66 #endif