summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/executor/executor.h5
-rw-r--r--src/include/replication/conflict.h58
2 files changed, 63 insertions, 0 deletions
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h
index 046a7fb69b0..69c3ebff00a 100644
--- a/src/include/executor/executor.h
+++ b/src/include/executor/executor.h
@@ -228,6 +228,10 @@ extern void ExecPartitionCheckEmitError(ResultRelInfo *resultRelInfo,
TupleTableSlot *slot, EState *estate);
extern void ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo,
TupleTableSlot *slot, EState *estate);
+extern char *ExecBuildSlotValueDescription(Oid reloid, TupleTableSlot *slot,
+ TupleDesc tupdesc,
+ Bitmapset *modifiedCols,
+ int maxfieldlen);
extern LockTupleMode ExecUpdateLockMode(EState *estate, ResultRelInfo *relinfo);
extern ExecRowMark *ExecFindRowMark(EState *estate, Index rti, bool missing_ok);
extern ExecAuxRowMark *ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist);
@@ -643,6 +647,7 @@ extern List *ExecInsertIndexTuples(ResultRelInfo *resultRelInfo,
extern bool ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo,
TupleTableSlot *slot,
EState *estate, ItemPointer conflictTid,
+ ItemPointer tupleid,
List *arbiterIndexes);
extern void check_exclusion_constraint(Relation heap, Relation index,
IndexInfo *indexInfo,
diff --git a/src/include/replication/conflict.h b/src/include/replication/conflict.h
new file mode 100644
index 00000000000..02cb84da7ea
--- /dev/null
+++ b/src/include/replication/conflict.h
@@ -0,0 +1,58 @@
+/*-------------------------------------------------------------------------
+ * conflict.h
+ * Exports for conflicts logging.
+ *
+ * Copyright (c) 2024, PostgreSQL Global Development Group
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef CONFLICT_H
+#define CONFLICT_H
+
+#include "nodes/execnodes.h"
+#include "utils/timestamp.h"
+
+/*
+ * Conflict types that could occur while applying remote changes.
+ */
+typedef enum
+{
+ /* The row to be inserted violates unique constraint */
+ CT_INSERT_EXISTS,
+
+ /* The row to be updated was modified by a different origin */
+ CT_UPDATE_DIFFER,
+
+ /* The updated row value violates unique constraint */
+ CT_UPDATE_EXISTS,
+
+ /* The row to be updated is missing */
+ CT_UPDATE_MISSING,
+
+ /* The row to be deleted was modified by a different origin */
+ CT_DELETE_DIFFER,
+
+ /* The row to be deleted is missing */
+ CT_DELETE_MISSING,
+
+ /*
+ * Other conflicts, such as exclusion constraint violations, involve more
+ * complex rules than simple equality checks. These conflicts are left for
+ * future improvements.
+ */
+} ConflictType;
+
+extern bool GetTupleTransactionInfo(TupleTableSlot *localslot,
+ TransactionId *xmin,
+ RepOriginId *localorigin,
+ TimestampTz *localts);
+extern void ReportApplyConflict(EState *estate, ResultRelInfo *relinfo,
+ int elevel, ConflictType type,
+ TupleTableSlot *searchslot,
+ TupleTableSlot *localslot,
+ TupleTableSlot *remoteslot,
+ Oid indexoid, TransactionId localxmin,
+ RepOriginId localorigin, TimestampTz localts);
+extern void InitConflictIndexes(ResultRelInfo *relInfo);
+
+#endif