From 01f53cbacf3ce068d827d7b4c0be241eacaa8ee1 Mon Sep 17 00:00:00 2001 From: Hou Zhijie Date: Tue, 13 Aug 2024 16:08:36 +0800 Subject: [PATCH v20] Doc: explain the log format of logical replication conflict This commit adds a detailed explanation of the log format for logical replication conflicts to the documentation. It aims to help users better understand conflict logs. --- doc/src/sgml/logical-replication.sgml | 75 +++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml index 885a2d70ae..8ea695074b 100644 --- a/doc/src/sgml/logical-replication.sgml +++ b/doc/src/sgml/logical-replication.sgml @@ -1666,6 +1666,81 @@ test_sub=# SELECT * FROM t1 ORDER BY id; log. + + The log format for logical replication conflicts is as follows: + +LOG: conflict detected on relation "schemaname.tablename": conflict=conflict_type +DETAIL: detailed explanation. + +Key (column_name, ...)=(column_value, ...) +; existing local tuple (column_name, ...)=(column_value, ...); remote tuple (column_name, ...)=(column_value, ...); replica identity {(column_name, ...)=(column_value, ...) | full (column_value, ...)}. + + The log provides the following information: + + + LOG + + + + + The name of the local relation involved in the conflict and the conflict + type (e.g., insert_exists, + update_exists). + + + + + + + DETAIL + + + + + The origin, transaction ID, and commit timestamp of the transaction that + modified the existing local tuple, if available, are included in the + detailed explanation. + + + + + The key section includes the key values of the local + tuple that violated a unique constraint insert_exists + or update_exists conflicts. + + + + + The existing local tuple section includes the local + tuple if its origin differs from the remote tuple in cases of + update_differ or delete_differ + conflicts, or if the key value conflicts with the remote tuple in cases + of insert_exists or update_exists + conflicts. + + + + + The remote tuple section includes the new tuple from + the remote insert or update operation that caused the conflict. Note that + for an update operation, the column value of the new tuple will be null + if the value is unchanged and toasted. + + + + + The replica identity section includes the replica + identity key values that used to search for the existing local tuple to + be updated or deleted. This may include the full tuple value if the local + relation is marked with REPLICA IDENTITY FULL. + + + + + + + + Logical replication operations are performed with the privileges of the role which owns the subscription. Permissions failures on target tables will -- 2.30.0.windows.2