PostgreSQL Source Code
git master
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
c
d
g
h
i
k
l
m
p
r
s
t
Functions
Variables
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
Data Fields
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
c
d
f
h
i
n
o
p
r
s
t
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
conflict.h
Go to the documentation of this file.
1
/*-------------------------------------------------------------------------
2
* conflict.h
3
* Exports for conflicts logging.
4
*
5
* Copyright (c) 2024-2025, PostgreSQL Global Development Group
6
*
7
*-------------------------------------------------------------------------
8
*/
9
#ifndef CONFLICT_H
10
#define CONFLICT_H
11
12
#include "
nodes/execnodes.h
"
13
#include "
utils/timestamp.h
"
14
15
/*
16
* Conflict types that could occur while applying remote changes.
17
*
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.
23
*/
24
typedef
enum
25
{
26
/* The row to be inserted violates unique constraint */
27
CT_INSERT_EXISTS
,
28
29
/* The row to be updated was modified by a different origin */
30
CT_UPDATE_ORIGIN_DIFFERS
,
31
32
/* The updated row value violates unique constraint */
33
CT_UPDATE_EXISTS
,
34
35
/* The row to be updated is missing */
36
CT_UPDATE_MISSING
,
37
38
/* The row to be deleted was modified by a different origin */
39
CT_DELETE_ORIGIN_DIFFERS
,
40
41
/* The row to be deleted is missing */
42
CT_DELETE_MISSING
,
43
44
/* The row to be inserted/updated violates multiple unique constraint */
45
CT_MULTIPLE_UNIQUE_CONFLICTS
,
46
47
/*
48
* Other conflicts, such as exclusion constraint violations, involve more
49
* complex rules than simple equality checks. These conflicts are left for
50
* future improvements.
51
*/
52
}
ConflictType
;
53
54
#define CONFLICT_NUM_TYPES (CT_MULTIPLE_UNIQUE_CONFLICTS + 1)
55
56
/*
57
* Information for the existing local tuple that caused the conflict.
58
*/
59
typedef
struct
ConflictTupleInfo
60
{
61
TupleTableSlot
*
slot
;
/* tuple slot holding the conflicting local
62
* tuple */
63
Oid
indexoid
;
/* OID of the index where the conflict
64
* occurred */
65
TransactionId
xmin
;
/* transaction ID of the modification causing
66
* the conflict */
67
RepOriginId
origin
;
/* origin identifier of the modification */
68
TimestampTz
ts
;
/* timestamp of when the modification on the
69
* conflicting local tuple occurred */
70
}
ConflictTupleInfo
;
71
72
extern
bool
GetTupleTransactionInfo
(
TupleTableSlot
*localslot,
73
TransactionId
*xmin,
74
RepOriginId
*localorigin,
75
TimestampTz
*localts);
76
extern
void
ReportApplyConflict
(
EState
*estate,
ResultRelInfo
*relinfo,
77
int
elevel,
ConflictType
type
,
78
TupleTableSlot
*searchslot,
79
TupleTableSlot
*remoteslot,
80
List
*conflicttuples);
81
extern
void
InitConflictIndexes
(
ResultRelInfo
*relInfo);
82
#endif
TransactionId
uint32 TransactionId
Definition:
c.h:623
ConflictType
ConflictType
Definition:
conflict.h:25
CT_MULTIPLE_UNIQUE_CONFLICTS
@ CT_MULTIPLE_UNIQUE_CONFLICTS
Definition:
conflict.h:45
CT_DELETE_MISSING
@ CT_DELETE_MISSING
Definition:
conflict.h:42
CT_UPDATE_ORIGIN_DIFFERS
@ CT_UPDATE_ORIGIN_DIFFERS
Definition:
conflict.h:30
CT_INSERT_EXISTS
@ CT_INSERT_EXISTS
Definition:
conflict.h:27
CT_UPDATE_EXISTS
@ CT_UPDATE_EXISTS
Definition:
conflict.h:33
CT_UPDATE_MISSING
@ CT_UPDATE_MISSING
Definition:
conflict.h:36
CT_DELETE_ORIGIN_DIFFERS
@ CT_DELETE_ORIGIN_DIFFERS
Definition:
conflict.h:39
ConflictTupleInfo
struct ConflictTupleInfo ConflictTupleInfo
ReportApplyConflict
void ReportApplyConflict(EState *estate, ResultRelInfo *relinfo, int elevel, ConflictType type, TupleTableSlot *searchslot, TupleTableSlot *remoteslot, List *conflicttuples)
Definition:
conflict.c:103
InitConflictIndexes
void InitConflictIndexes(ResultRelInfo *relInfo)
Definition:
conflict.c:138
GetTupleTransactionInfo
bool GetTupleTransactionInfo(TupleTableSlot *localslot, TransactionId *xmin, RepOriginId *localorigin, TimestampTz *localts)
Definition:
conflict.c:62
TimestampTz
int64 TimestampTz
Definition:
timestamp.h:39
execnodes.h
Oid
unsigned int Oid
Definition:
postgres_ext.h:30
ConflictTupleInfo
Definition:
conflict.h:60
ConflictTupleInfo::ts
TimestampTz ts
Definition:
conflict.h:68
ConflictTupleInfo::indexoid
Oid indexoid
Definition:
conflict.h:63
ConflictTupleInfo::origin
RepOriginId origin
Definition:
conflict.h:67
ConflictTupleInfo::xmin
TransactionId xmin
Definition:
conflict.h:65
ConflictTupleInfo::slot
TupleTableSlot * slot
Definition:
conflict.h:61
EState
Definition:
execnodes.h:652
List
Definition:
pg_list.h:54
ResultRelInfo
Definition:
execnodes.h:468
TupleTableSlot
Definition:
tuptable.h:115
timestamp.h
type
const char * type
Definition:
wait_event_funcs.c:27
RepOriginId
uint16 RepOriginId
Definition:
xlogdefs.h:65
src
include
replication
conflict.h
Generated on Tue Apr 22 2025 12:13:27 for PostgreSQL Source Code by
1.9.4