Subject: [PATCH] Warn when creating or enabling a subscription with logical replication disabled

From: Yugo Nagata <[email-masked]>
Date: Sun, 1 Feb 2026 23:09:46 +0900

If max_logical_replication_workers is zero, logical replication is
disabled and will never start, even if a subscription is created or
enabled. Previously, these commands completed successfully without any
warning, making it difficult to notice that logical replication could
not start.

Emit warnings in these cases to make this situation more visible.
---
 src/backend/commands/subscriptioncmds.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 0b3c8499b49..55ba4bfb53e 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -906,7 +906,14 @@ CreateSubscription(ParseState *pstate, CreateSubscriptionStmt *stmt,
 	 * conflict during replication.
 	 */
 	if (opts.enabled || opts.retaindeadtuples)
+	{
+		if (max_logical_replication_workers == 0)
+			ereport(WARNING,
+					(errmsg("subscription was created, but logical replication is disabled"),
+					 errhint("To initiate replication, set \"max_logical_replication_workers\" to a non zero value.")));
+
 		ApplyLauncherWakeupAtCommit();
+	}
 
 	ObjectAddressSet(myself, SubscriptionRelationId, subid);
 
@@ -1694,7 +1701,14 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
 				replaces[Anum_pg_subscription_subenabled - 1] = true;
 
 				if (opts.enabled)
+				{
+					if (max_logical_replication_workers == 0)
+						ereport(WARNING,
+								(errmsg("subscription was enabled, but logical replication is disabled"),
+								 errhint("To initiate replication, set \"max_logical_replication_workers\" to a non zero value.")));
+
 					ApplyLauncherWakeupAtCommit();
+				}
 
 				update_tuple = true;
 
-- 
2.43.0

--Multipart=_Wed__4_Feb_2026_14_07_31_+0900_OBYONg+Os_HuGbBm--