| From: | Baji Shaik <baji(dot)pgdev(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL-development <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Cc: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
| Subject: | pg_dump writes a subscription's default slot name, which can't be restored |
| Date: | 2026-12-03 01:43:58 |
| Message-ID: | CA+fm-RNDXWK9WwfQykPj3sui_GcmUtqo1T-xWGHNnpVSumZ=tQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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?
Regards,
Baji Shaik
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-pg_dump-Don-t-dump-a-subscription-s-default-slot-nam.patch | application/octet-stream | 5.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Richard Guo | 2026-12-03 02:27:17 | Re: Wrong results with references to JOIN USING aliases |
| Previous Message | Richard Guo | 2026-12-03 01:27:14 | Re: Simplify the uniqueness proof for self-join elimination |