pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[PATCH] Warn when creating or enabling a subscription with logical replication disabled
1+ messages / 1 participants
[nested] [flat]

* [PATCH] Warn when creating or enabling a subscription with logical replication disabled
@ 2026-02-01 14:09 Yugo Nagata <nagata@sraoss.co.jp>
  0 siblings, 0 replies; 1+ messages in thread

From: Yugo Nagata @ 2026-02-01 14:09 UTC (permalink / raw)

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(+)

inline patch 1: src/backend/commands/subscriptioncmds.c (+14/-0 lines) download inline-1.patchdiff --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-- ^ permalink raw reply [nested|flat] 1+ messages in thread


only message in thread

Thread overview: 1+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-02-01 14:09 [PATCH] Warn when creating or enabling a subscription with logical replication disabled Yugo Nagata <nagata@sraoss.co.jp>

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