From 15d6d7571168d2a532b06552fed0454077fc2e0f Mon Sep 17 00:00:00 2001
From: Shveta Malik <shveta.malik@gmail.com>
Date: Wed, 14 Feb 2024 17:29:25 +0530
Subject: [PATCH v2] Fix quotation of variable names.

This patch corrects the usage of double quotes for variable
names and values added by commit ddd5f4f54a.
---
 src/backend/replication/logical/slotsync.c    | 29 +++++++++----------
 .../t/040_standby_failover_slots_sync.pl      |  2 +-
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index 4cab7b7101..8196e25bfd 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -743,12 +743,12 @@ validate_remote_info(WalReceiverConn *wrconn)
 		ereport(ERROR,
 				errmsg("could not fetch primary_slot_name \"%s\" info from the primary server: %s",
 					   PrimarySlotName, res->err),
-				errhint("Check if \"primary_slot_name\" is configured correctly."));
+				errhint("Check if primary_slot_name is configured correctly."));
 
 	tupslot = MakeSingleTupleTableSlot(res->tupledesc, &TTSOpsMinimalTuple);
 	if (!tuplestore_gettupleslot(res->tuplestore, true, false, tupslot))
 		elog(ERROR,
-			 "failed to fetch tuple for the primary server slot specified by \"primary_slot_name\"");
+			 "failed to fetch tuple for the primary server slot specified by primary_slot_name");
 
 	remote_in_recovery = DatumGetBool(slot_getattr(tupslot, 1, &isnull));
 	Assert(!isnull);
@@ -764,9 +764,9 @@ validate_remote_info(WalReceiverConn *wrconn)
 	if (!primary_slot_valid)
 		ereport(ERROR,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("bad configuration for slot synchronization"),
+				errmsg("slot synchronization requires valid primary_slot_name"),
 		/* translator: second %s is a GUC variable name */
-				errdetail("The replication slot \"%s\" specified by \"%s\" does not exist on the primary server.",
+				errdetail("The replication slot \"%s\" specified by %s does not exist on the primary server.",
 						  PrimarySlotName, "primary_slot_name"));
 
 	ExecClearTuple(tupslot);
@@ -792,8 +792,7 @@ ValidateSlotSyncParams(void)
 		ereport(ERROR,
 		/* translator: %s is a GUC variable name */
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("bad configuration for slot synchronization"),
-				errhint("\"%s\" must be defined.", "primary_slot_name"));
+				errmsg("slot synchronization requires %s to be defined", "primary_slot_name"));
 
 	/*
 	 * hot_standby_feedback must be enabled to cooperate with the physical
@@ -804,15 +803,14 @@ ValidateSlotSyncParams(void)
 		ereport(ERROR,
 		/* translator: %s is a GUC variable name */
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("bad configuration for slot synchronization"),
-				errhint("\"%s\" must be enabled.", "hot_standby_feedback"));
+				errmsg("slot synchronization requires %s to be enabled",
+					   "hot_standby_feedback"));
 
 	/* Logical slot sync/creation requires wal_level >= logical. */
 	if (wal_level < WAL_LEVEL_LOGICAL)
 		ereport(ERROR,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("bad configuration for slot synchronization"),
-				errhint("\"wal_level\" must be >= logical."));
+				errmsg("slot synchronization requires wal_level >= \"logical\""));
 
 	/*
 	 * The primary_conninfo is required to make connection to primary for
@@ -822,8 +820,8 @@ ValidateSlotSyncParams(void)
 		ereport(ERROR,
 		/* translator: %s is a GUC variable name */
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("bad configuration for slot synchronization"),
-				errhint("\"%s\" must be defined.", "primary_conninfo"));
+				errmsg("slot synchronization requires %s to be defined",
+					   "primary_conninfo"));
 
 	/*
 	 * The slot synchronization needs a database connection for walrcv_exec to
@@ -834,12 +832,11 @@ ValidateSlotSyncParams(void)
 		ereport(ERROR,
 
 		/*
-		 * translator: 'dbname' is a specific option; %s is a GUC variable
-		 * name
+		 * translator: dbname is a specific option; %s is a GUC variable name
 		 */
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("bad configuration for slot synchronization"),
-				errhint("'dbname' must be specified in \"%s\".", "primary_conninfo"));
+				errmsg("slot synchronization requires dbname to be specified in %s",
+					   "primary_conninfo"));
 }
 
 /*
diff --git a/src/test/recovery/t/040_standby_failover_slots_sync.pl b/src/test/recovery/t/040_standby_failover_slots_sync.pl
index 2755c3fc84..0f2f819f53 100644
--- a/src/test/recovery/t/040_standby_failover_slots_sync.pl
+++ b/src/test/recovery/t/040_standby_failover_slots_sync.pl
@@ -319,7 +319,7 @@ $standby1->reload;
 ($result, $stdout, $stderr) =
   $standby1->psql('postgres', "SELECT pg_sync_replication_slots();");
 ok( $stderr =~
-	  /HINT:  'dbname' must be specified in "primary_conninfo"/,
+	  /ERROR:  slot synchronization requires dbname to be specified in primary_conninfo/,
 	"cannot sync slots if dbname is not specified in primary_conninfo");
 
 ##################################################
-- 
2.34.1

