public inbox for [email protected]  
help / color / mirror / Atom feed
From: Yugo Nagata <[email protected]>
Subject: [PATCH] Warn when creating or enabling a subscription with logical replication disabled
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--





view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH] Warn when creating or enabling a subscription with logical replication disabled
  In-Reply-To: <no-message-id-600015@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox