From 0d37a238a3619fec77b548e18015616b0ed72406 Mon Sep 17 00:00:00 2001 From: Hayato Kuroda Date: Tue, 20 Jan 2026 13:15:04 +0900 Subject: [PATCH v3] Add Assert() for {UPDATE|DELETE}_ORIGIN_DIFFERS errdetail_apply_conflict() assumes that the timestamp for the local commit is always available. That assumption is valid because these types of conflicts can be detected when track_commit_timestamp is enabled. This commit adds Assert() for clarification. Author: Hayato Kuroda Reviewed-by: Shveta Malik Reviewed-by: Chao Li --- src/backend/replication/logical/conflict.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/backend/replication/logical/conflict.c b/src/backend/replication/logical/conflict.c index 722514149fe..fd7c7c43f73 100644 --- a/src/backend/replication/logical/conflict.c +++ b/src/backend/replication/logical/conflict.c @@ -323,6 +323,14 @@ errdetail_apply_conflict(EState *estate, ResultRelInfo *relinfo, break; case CT_UPDATE_ORIGIN_DIFFERS: + + /* + * UPDATE_ORIGIN_DIFFERS conflict is reported only when + * track_commit_timestamp is enabled, and a valid local commit + * timestamp is available for the conflicting row. + */ + Assert(localts != 0); + if (localorigin == InvalidRepOriginId) appendStringInfo(&err_detail, _("Updating the row that was modified locally in transaction %u at %s"), localxmin, timestamptz_to_str(localts)); @@ -377,6 +385,14 @@ errdetail_apply_conflict(EState *estate, ResultRelInfo *relinfo, break; case CT_DELETE_ORIGIN_DIFFERS: + + /* + * DELETE_ORIGIN_DIFFERS conflict is reported only when + * track_commit_timestamp is enabled, and a valid local commit + * timestamp is available for the conflicting row. + */ + Assert(localts != 0); + if (localorigin == InvalidRepOriginId) appendStringInfo(&err_detail, _("Deleting the row that was modified locally in transaction %u at %s"), localxmin, timestamptz_to_str(localts)); -- 2.47.3