From b848e5c55b3a875d75e2f717bdaa529c698e17ec Mon Sep 17 00:00:00 2001 From: "Chao Li (Evan)" Date: Wed, 2 Dec 2026 15:37:41 +0800 Subject: [PATCH v1] Fix reversed slot types in copy_replication_slot() error messages When the source slot type differed from the requested type, the error message reported the two types in reverse order. Fix this by swapping the two errmsg() calls and updating the expected regression output. Oversight in 9f06d79e. Author: Chao Li --- contrib/test_decoding/expected/slot.out | 4 ++-- src/backend/replication/slotfuncs.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/test_decoding/expected/slot.out b/contrib/test_decoding/expected/slot.out index cf0136455b0..1eaf762ac95 100644 --- a/contrib/test_decoding/expected/slot.out +++ b/contrib/test_decoding/expected/slot.out @@ -286,7 +286,7 @@ ORDER BY o.slot_name, c.slot_name; -- Cannot copy a logical slot to a physical slot SELECT 'copy' FROM pg_copy_physical_replication_slot('orig_slot2', 'failed'); -- error -ERROR: cannot copy physical replication slot "orig_slot2" as a logical replication slot +ERROR: cannot copy logical replication slot "orig_slot2" as a physical replication slot -- temporary slots were dropped automatically SELECT pg_drop_replication_slot('copied_slot2_change_plugin_temp'); pg_drop_replication_slot @@ -334,7 +334,7 @@ SELECT slot_name, slot_type, temporary FROM pg_replication_slots; -- Cannot copy a physical slot to a logical slot SELECT 'copy' FROM pg_copy_logical_replication_slot('orig_slot1', 'failed'); -- error -ERROR: cannot copy logical replication slot "orig_slot1" as a physical replication slot +ERROR: cannot copy physical replication slot "orig_slot1" as a logical replication slot -- Cannot copy a physical slot that doesn't reserve WAL SELECT 'copy' FROM pg_copy_physical_replication_slot('orig_slot2', 'failed'); -- error ERROR: cannot copy a replication slot that doesn't reserve WAL diff --git a/src/backend/replication/slotfuncs.c b/src/backend/replication/slotfuncs.c index fdeb6a23d7b..6c87986956f 100644 --- a/src/backend/replication/slotfuncs.c +++ b/src/backend/replication/slotfuncs.c @@ -707,9 +707,9 @@ copy_replication_slot(FunctionCallInfo fcinfo, bool logical_slot) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), src_islogical ? - errmsg("cannot copy physical replication slot \"%s\" as a logical replication slot", - NameStr(*src_name)) : errmsg("cannot copy logical replication slot \"%s\" as a physical replication slot", + NameStr(*src_name)) : + errmsg("cannot copy physical replication slot \"%s\" as a logical replication slot", NameStr(*src_name)))); /* Copying non-reserved slot doesn't make sense */ -- 2.50.1 (Apple Git-155)