Re: Skipping schema changes in publication

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: 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>, Peter Smith <smithpb2250(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-13 10:00:05
Message-ID: CAA4eK1J4MHS7Y9XKTrjhcMN9nkPe0dw5oiRa4nCK1qr1cOF__A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 11, 2026 at 11:24 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> >
> > 2. Parentheses around the exclusion list
> >
> > Parentheses are required to clearly separate the excluded objects from
> > other elements in the publication definition, especially when mixed
> > with inclusion clauses. For example, consider a future case like:
> >
> > CREATE PUBLICATION pub
> > FOR TABLES IN SCHEMA s1
> > EXCEPT TABLE (t1, t2), TABLE t3;
> >
> > Here it is clear that t1 and t2 are excluded, while t3 is explicitly
> > included. Without parentheses, a statement like:
> >
> > CREATE PUBLICATION pub
> > FOR TABLES IN SCHEMA s1
> > EXCEPT TABLE t1, t2, TABLE t3;
> >
> > would be harder to interpret and potentially ambiguous.
> >
> > So although the syntax differs slightly from the existing inclusion
> > list (e.g., TABLE a, b), requiring both the TABLE keyword and
> > parentheses after EXCEPT helps keep the grammar unambiguous and makes
> > the syntax easier to extend in the future.
>
> I'm still unsure that the syntax like TABLE (t1, t2) for the exclusion
> list is syntactically correct. The syntax of TABLE (...) is already
> used in a quite different way as follows (borrowed an example from
> stats_import.sql):
>
> CREATE FUNCTION stats_import.pg_statistic_get_difference(a text, b text)
> RETURNS TABLE (relname text, stats stats_import.pg_statistic_flat_t)
>

Both are different usage and not clear if they are comparable.

>
> Wouldn't it be more appropriate to use a plural form or the IN
> keyword, such as EXCEPT TABLES (t1, t2) or EXCEPT TABLES IN (t1, t2)?
>

We can consider it. Let's try to compare it with following existing
publication syntax:

CREATE PUBLICATION production_publication FOR TABLE users,
departments, TABLES IN SCHEMA production;
CREATE PUBLICATION alltables FOR ALL TABLES;

Here we used singular form when a user could specify one or more
objects and plural when all objects of schema or database are
considered.

As per this, the except syntax falls in the singular category which is
in favor of current syntax.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2026-03-13 10:01:56 Re: Add "format" target to make and ninja to run pgindent and pgperltidy
Previous Message Amit Kapila 2026-03-13 09:51:34 Re: Skipping schema changes in publication