From d4dbac3669d96d40d56fe5e738da9a78a3fcfb47 Mon Sep 17 00:00:00 2001
From: Alexander Kukushkin <cyberdemn@gmail.com>
Date: Mon, 8 Sep 2025 11:16:54 +0200
Subject: [PATCH] Exclude parallel workers when validating
 synchronized_standby_slots

If synchronized_standby_slots value is invalid parallel workers fail to
start with the following error:
ERROR:  invalid value for parameter "synchronized_standby_slots": "a1,b1"
DETAIL:  replication slot "a1" does not exist
CONTEXT:  while setting parameter "synchronized_standby_slots" to "a1,b1"

Since the value can't be properly validated from postmaster process we
shouldn't fail in parallel workers either.
---
 src/backend/replication/slot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c
index a234e2ca9c1..76ce7a35a01 100644
--- a/src/backend/replication/slot.c
+++ b/src/backend/replication/slot.c
@@ -39,6 +39,7 @@
 #include <unistd.h>
 #include <sys/stat.h>
 
+#include "access/parallel.h"
 #include "access/transam.h"
 #include "access/xlog_internal.h"
 #include "access/xlogrecovery.h"
@@ -2441,7 +2442,7 @@ validate_sync_standby_slots(char *rawname, List **elemlist)
 	{
 		GUC_check_errdetail("List syntax is invalid.");
 	}
-	else if (MyProc)
+	else if (MyProc && !IsParallelWorker())
 	{
 		/*
 		 * Check that each specified slot exist and is physical.
-- 
2.34.1

