Re: Skipping schema changes in publication

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, YeXiu <1518981153(at)qq(dot)com>, Ian Lawrence Barwick <barwick(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Skipping schema changes in publication
Date: 2026-03-18 06:20:34
Message-ID: CAD21AoCuy_yAtzLa+cHEM5hRN3u8Ff0jXrZiyeBD9dc+bqhkLA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Mar 14, 2026 at 2:35 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Fri, Mar 13, 2026 at 11:51 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> >
> > On Fri, Mar 13, 2026 at 2:51 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> > >
> > > On Fri, Mar 13, 2026 at 8:55 AM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
> > > >
> > > > Hou-San (off-list) gave an interesting example of how it might look
> > > > when the example is combined with the hypothetical future ability to
> > > > exclude all schema tables from a "FOR ALL TABLES"
> > > > CREATE PUBLICATION pub FOR ALL TABLES EXCEPT (TABLE t1, t2, TABLES IN
> > > > SCHEMA s1);
> > > >
> > >
> > > So, if we follow this, in future, the syntax would look like:
> > > Create publication pub1 FOR ALL TABLES EXCEPT (TABLE t1, t2, TABLES IN
> > > SCHEMA s1, s2), ALL SEQUENCES EXCEPT (SEQUENCE s1);
> > >
> > > I think if we use the above syntax then one can also argue that why
> > > not use FOR ALL (TABLES, SEQUENCES) instead of ALL TABLES, ALL
> > > SEQUENCES.
> >
> > The same is true for the syntaxes of TABLE(t1, t2) and SCHEMA(s1, s2),
> > no? If we allow grouping the tables and the schemas by TABLE and
> > SCHEMA keywords respectively in exclusion lists, one could argue why
> > we don't allow it for the inclusion list.
> >
> > >
> > > Instead the current command would like:
> > > Create publication pub1 FOR ALL TABLES EXCEPT TABLE (t1, t2), EXCEPT
> > > TABLES IN SCHEMA (s1, s2), ALL SEQUENCES EXCEPT SEQUENCE (seq1, seq2);
> > >
> > > Though it is slightly lengthy it makes the syntax local such that the
> > > meaning of a clause is determined by what is inside it, not by
> > > something that appears ten words later.
> >
> > While it helps the syntax locality, I'm concerned that it could make
> > the context of the EXCEPT clause ambiguous. For example, IIUC the
> > above syntax rule would allow us to write:
> >
> > CREATE PUBLICATION pub1 FOR ALL TABLES EXCEPT TABLES IN SCHEMA (s1),
> > EXCEPT TABLE (t1);
> >
> > Regarding the second EXCEPT clause, while one might think it excludes
> > t1 from ALL TABLES, one might think it excludes t1 from the first
> > EXCLUDE clause (i.e., the publication actually includes t1 in the
> > publication).
> >
>
> According to me, the comma between EXCEPT clauses breaks such a chain
> of thought but others may think differently. The docs can clarify such
> a confusion if any but if multiple people interpret it the way you
> think, I am fine to go with the direction you are proposing. I am
> slightly worried that both syntaxes have some pros and cons, so even
> if we change to what you are suggesting, one can argue to go back to
> previous syntax as that also has some merits. So, I feel we can
> complete the pending patch [1] and try to get the opinion of some
> other people unless changing the code to support another alternative
> is difficult.

I agree to complete the pending ALTER PUBLICATION part first and then
have more discussion on it. As Vignesh showed in another email, the
changes are straightforward.

Regards,

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message zengman 2026-03-18 06:31:03 Re: SQL Property Graph Queries (SQL/PGQ)
Previous Message Alexander Pyhalov 2026-03-18 06:17:15 Re: Asynchronous MergeAppend