| From: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
|---|---|
| To: | Baji Shaik <baji(dot)pgdev(at)gmail(dot)com> |
| Cc: | PostgreSQL-development <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: pg_dump writes a subscription's default slot name, which can't be restored |
| Date: | 2026-12-03 18:44:27 |
| Message-ID: | CAD21AoB6DfOTG4CqQ20FNVysBfybeORxSmY4BJCHcuAFphuW5w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, Dec 2, 2026 at 5:44 PM Baji Shaik <baji(dot)pgdev(at)gmail(dot)com> 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alain LESAGE | 2026-12-03 19:07:58 | Re: [PATCH] Avoid copying tuples that a bounded sort will discard |
| Previous Message | Tomas Vondra | 2026-12-03 18:43:56 | Re: index prefetching |