On Wed, Dec 2, 2026 at 5:44 PM Baji Shaik <[email protected]> wrote:
>
> Hi,
>
> A subscription with a name that isn't a valid slot name can be created
> with connect = false, because the default slot name (the subscription
> name) is not validated:
>
>   CREATE SUBSCRIPTION "MySub" CONNECTION 'dbname=postgres'
>     PUBLICATION p WITH (connect = false);
>
> pg_dump always writes the slot name explicitly, and an explicit
> slot_name is validated, so the restore fails:
>
>   CREATE SUBSCRIPTION "MySub" CONNECTION 'dbname=postgres' PUBLICATION p
>     WITH (connect = false, slot_name = 'MySub', streaming = parallel);
>   ERROR:  replication slot name "MySub" contains invalid character
>
> pg_upgrade fails the same way.
> The attached patch makes pg_dump leave slot_name out when it equals the
> subscription name, so the restore applies the same default.
>
> One case it doesn't cover: a subscription renamed after creation keeps
> its old slot name, which then gets written explicitly.  Fixing that
> would mean not validating slot_name locally when connect = false.
>
> Thoughts?

Instead of changing pg_dump, can we validate the subscription name if
CREATE SUBSCRIPTION uses the subscription name as the slot name?

Regards,

-- 
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com


Reply via email to