From 9ff39c822183b1f50eb0cc5b033445acbb042db9 Mon Sep 17 00:00:00 2001 From: Hayato Kuroda Date: Tue, 20 Jan 2026 13:15:04 +0900 Subject: [PATCH v2] 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 --- src/backend/replication/logical/conflict.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/backend/replication/logical/conflict.c b/src/backend/replication/logical/conflict.c index 722514149fe..f0617c14826 100644 --- a/src/backend/replication/logical/conflict.c +++ b/src/backend/replication/logical/conflict.c @@ -323,6 +323,13 @@ errdetail_apply_conflict(EState *estate, ResultRelInfo *relinfo, break; case CT_UPDATE_ORIGIN_DIFFERS: + + /* + * We reach this point only if track_commit_timestamp is enabled. + * Therefore, localts must contain a valid timestamp. + */ + Assert(localts); + 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 +384,13 @@ errdetail_apply_conflict(EState *estate, ResultRelInfo *relinfo, break; case CT_DELETE_ORIGIN_DIFFERS: + + /* + * We reach this point only if track_commit_timestamp is enabled. + * Therefore, localts must contain a valid timestamp. + */ + Assert(localts); + 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