Hi, I would like to propose emitting a warning when creating or enabling a subscription while max_logical_replication_workers is set to 0. In this case, the CREATE/ALTER SUBSCRIPTION command completes successfully without any warning, making it difficult to notice that logical replication cannot start.
Of course, users can confirm whether logical replication is working by checking system views such as pg_stat_replication or pg_stat_subscription. However, emitting warnings explicitly in these cases would make this situation more visible. We have seen user reports where this behavior caused confusion, with users wondering why replication did not start. I've attached a patch to address this. Regards, Yugo Nagata -- Yugo Nagata <[email protected]>
>From 6e59f4bd435b7e34837559c952f6b04475b43b09 Mon Sep 17 00:00:00 2001 From: Yugo Nagata <[email protected]> Date: Sun, 1 Feb 2026 23:09:46 +0900 Subject: [PATCH] Warn when creating or enabling a subscription with logical replication disabled 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
