[PATCH] Add max_logical_replication_slots GUC
Ahmed Et-tanany <ahmed.ettanany@aiven.io>
From: Ahmed Et-tanany <ahmed.ettanany@aiven.io>
To: pgsql-hackers@lists.postgresql.org
Date: 2026-01-28T10:16:21Z
Lists: pgsql-hackers
Attachments
- 0001-Add-max_logical_replication_slots-GUC-v1.patch (text/x-patch) patch v1-0001
Hello Hackers, This patch introduces a new postmaster-level configuration parameter, max_logical_replication_slots, which limits the number of logical replication slots that can be created. Currently, max_replication_slots governs the total number of slots, but there's no separate limit for logical slots. This patch: Adds max_logical_replication_slots GUC, defaulting to -1 (falls back to max_replication_slots). Enforces at server startup that max_logical_replication_slots ≤ max_replication_slots. PostgreSQL will refuse to start if this is violated or if there are more existing logical slots than the configured maximum. Checks the logical slot limit when creating new slots at runtime, preventing creation beyond the configured maximum. Updates documentation, sample config, and test_decoding tests to include logical slot limits. This provides a separation between logical and total replication slots, and allows users to control logical slot usage independently. Best regards, -- Ahmed Et-tanany Aiven: https://aiven.io/