Re: CREATE/ALTER PUBLICATION improvements for syntax synopsis

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: CREATE/ALTER PUBLICATION improvements for syntax synopsis
Date: 2025-11-20 04:07:42
Message-ID: CAHut+PuqjvkH2SSraBML85h0C+0=jLU35BV6q1uLq3efag14nw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 20, 2025 at 2:06 PM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>
>
>
> > On Nov 20, 2025, at 09:41, Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
> >
> > On Thu, Nov 20, 2025 at 12:03 PM Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> >>
> >> On Thu, Nov 20, 2025 at 9:02 AM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
> >>> V6 looks better.
> >>
> >> +1. Thanks for updating the patch!
> >>
> >> +<phrase>and <replaceable class="parameter">table</replaceable> is:</phrase>
> >> +
> >> + [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
> >>
> >> I have one question: in lock.sgml and truncate.sgml, the syntax
> >> "[ ONLY ] name [ * ] [, ... ]" seems shown as acceptable (though
> >> I'm not entirely sure it's actually valid). If that form is allowed,
> >> then this change may not be necessary?
> >>
> >
> > I think if this were strict BNF rules, then the bindings of the "..."
> > are not correct. I think the Postgres documentation is a bit loose
> > with the rules (e.g. your TRUNCATE example is deemed acceptable)
> >
> > A user might also wonder if "ONLY a,b" means the same as "ONLY a", "ONLY b"?
> >
> > But, in the interest of not bloating the ALTER PUBLICATION synopsis
> > too much, and still being consistent with what seems accepted by
> > existing PG docs, I am happy to remove that extra 'table' replacement
> > class. Maybe it's a bit ambiguous, but it seems mostly harmless.
> >
> > Thoughts?
> >
>
> I think the new code of publication_drop_object has changed the original meaning.
>
> Old code:
> ```
> - TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [, ... ]
> ```
>
> Means the drop clause can be:
> ```
> ALTER PUBLICATION DROP TABLE ONLY t1*, TABLE ONLY t2*
> ```
>
> Now, the new code:
> ```
> + TABLE <replaceable class="parameter">table</replaceable> [, … ]
> <phrase>and <replaceable class="parameter">table</replaceable> is:</phrase>
> +
> + [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
> ```
>
> Changes the meaning to:
> ```
> ALTER PUBLICATION DROP TABLE ONLY t1*, ONLY t2*
> ```
>

There are 2 sets of ellipses:
Here: "publication_drop_object [, ...]"
And here "TABLE <replaceable class="parameter">table</replaceable> [, … ]"

So I think there is no change of meaning. AFAICT all variations are
possible, same as they always were. It just depends which way you
squint at the syntax -- e.g. are you conceptually expanding another
"publication_drop_objecr" replacement or expanding another "table"
replacement.

> So, I think we should keep the old code.

Anyway, I am happy to go back to the old code. I'll post another patch
later to do that.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2025-11-20 04:20:57 Re: GNU/Hurd portability patches
Previous Message Chao Li 2025-11-20 03:36:42 Re: Use strtoi64() in pgbench, replacing its open-coded implementation