From 209030c136f7fed139d626506ae2a151ea318fdc Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 30 Mar 2021 15:01:31 +1100
Subject: [PATCH v1] Remove redundant errdetail "The error was".

Removed this redundant text because:

1. The extra text does not add anything useful to the DETAIL of the message.

2. It looks strange: "The error was: ERROR ...".

3. There seems no other errdetail examples in all of PG source which are worded like this.
---
 src/backend/commands/subscriptioncmds.c     | 6 +++---
 src/backend/replication/logical/tablesync.c | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 89abc81..adfc7fd 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -1429,7 +1429,7 @@ ReplicationSlotDropAtPubNode(WalReceiverConn *wrconn, char *slotname, bool missi
 			ereport(LOG,
 					(errmsg("could not drop the replication slot \"%s\" on publisher",
 							slotname),
-					 errdetail("The error was: %s", res->err)));
+					 errdetail("%s", res->err)));
 		}
 		else
 		{
@@ -1437,7 +1437,7 @@ ReplicationSlotDropAtPubNode(WalReceiverConn *wrconn, char *slotname, bool missi
 			ereport(ERROR,
 					(errmsg("could not drop the replication slot \"%s\" on publisher",
 							slotname),
-					 errdetail("The error was: %s", res->err)));
+					 errdetail("%s", res->err)));
 		}
 
 		walrcv_clear_result(res);
@@ -1653,7 +1653,7 @@ ReportSlotConnectionError(List *rstates, Oid subid, char *slotname, char *err)
 	ereport(ERROR,
 			(errmsg("could not connect to publisher when attempting to "
 					"drop the replication slot \"%s\"", slotname),
-			 errdetail("The error was: %s", err),
+			 errdetail("%s", err),
 	/* translator: %s is an SQL ALTER command */
 			 errhint("Use %s to disassociate the subscription from the slot.",
 					 "ALTER SUBSCRIPTION ... SET (slot_name = NONE)")));
diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c
index 2937f41..3ff433d 100644
--- a/src/backend/replication/logical/tablesync.c
+++ b/src/backend/replication/logical/tablesync.c
@@ -1040,7 +1040,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
 	if (res->status != WALRCV_OK_COMMAND)
 		ereport(ERROR,
 				(errmsg("table copy could not start transaction on publisher"),
-				 errdetail("The error was: %s", res->err)));
+				 errdetail("%s", res->err)));
 	walrcv_clear_result(res);
 
 	/*
@@ -1100,7 +1100,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
 	if (res->status != WALRCV_OK_COMMAND)
 		ereport(ERROR,
 				(errmsg("table copy could not finish transaction on publisher"),
-				 errdetail("The error was: %s", res->err)));
+				 errdetail("%s", res->err)));
 	walrcv_clear_result(res);
 
 	table_close(rel, NoLock);
-- 
1.8.3.1

