| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
| Cc: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Shubham Khanna <khannashubham1197(at)gmail(dot)com> |
| Subject: | Re: pg_createsubscriber: allow duplicate publication names |
| Date: | 2026-06-02 09:17:18 |
| Message-ID: | D5DC2F4C-A04A-4E7E-B7B8-7FA378B627E6@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On Jun 2, 2026, at 16:57, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Tue, Jun 2, 2026 at 1:29 PM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>>
>>> On Jun 2, 2026, at 15:32, Hayato Kuroda (Fujitsu) <kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
>>>
>>> Dear Chao, Amit,
>>>
>>>> In theory, yes, since subscription names are also unique per database. I didn’t
>>>> include that in v1 because the publication-name issue affects the new PG19
>>>> feature for reusing existing publications, whereas allowing duplicate subscription
>>>> names seems like an improvement that could be a material of v20.
>>>>
>>>> As you ask, I put the subscription-name change in 0002. Please decide how to
>>>> proceed. If you decide to accept both, they can be squashed.
>>>
>>> For subscription side, I had a concern that name duplication error can be more likely
>>> to happen if we specify the same subscription name for two databases. Because the
>>> same will be reused for the slot name. Reproducer:
>>>
>>> ```
>>> $ pg_createsubscriber -D data_sta/ -P 'user=postgres port=5432' -d postgres --subscription sub -d testdb --subscription sub -U postgres
>>> ...
>>> pg_createsubscriber: error: could not create replication slot "sub" in database "testdb": ERROR: replication slot "sub" already exists
>>> ```
>>>
>
> Can't we use --replication-slot=name to avoid this ERROR? I mean use
> different replication slot names.
Yes, we can.
The additional work I was thinking of is that, to support duplicate subscription names, when there are duplicate subscription names and the --replication-slot option is omitted, we may need an extra sanity check to prevent creating slots with the same name and then failing.
>
>>> Personally -1 to accept the idea as-is.
>>>
>>> Best regards,
>>> Hayato Kuroda
>>> FUJITSU LIMITED
>>>
>>
>> Good point. Allowing duplicate subscription names would require additional work, so let's leave that for v20. I'm going to withdraw 0002. I also updated 0001's commit message to explain why subscription names are excluded.
>>
>
> I was not suggesting to get the subscription work for PG19. Otherwise,
> your patch for publication names looks good to me.
>
Got it. I can put the subscription work on my TODO list for v20.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | solai v | 2026-06-02 09:42:10 | Re: problems with toast.* reloptions |
| Previous Message | Nisha Moond | 2026-06-02 08:57:24 | Re: Support EXCEPT for TABLES IN SCHEMA publications |