| From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
|---|---|
| To: | Dilip Kumar <dilipbalaut(at)gmail(dot)com> |
| Cc: | shveta malik <shveta(dot)malik(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(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>, "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-26 06:10:58 |
| Message-ID: | CAA4eK1LBf5asit18HcqcFinOkdCjD6Lk2Eid9PDhtH6acwYb8w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Mar 24, 2026 at 7:50 PM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
>
> On Mon, Mar 23, 2026 at 12:35 PM shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
> >
> > I would like to summarize the discussion/feedback for the EXCEPT
> > syntax implemented in [1].
> >
> > 1)
> > The currently implemented syntax is ([1]):
> >
> > CREATE PUBLICATION pub FOR ALL TABLES EXCEPT TABLE (a, b, c);
> >
> > There were concerns about why the TABLE keyword and the parentheses
> > '()' are required. These have been answered in [2].
> >
> > Please review the discussion there.
> >
> > 2)
> > Another feedback on current syntax was to move the TABLE keyword
> > inside the parentheses:
> >
> > CREATE PUBLICATION pub FOR ALL TABLES EXCEPT (TABLE t1, TABLE t2,
> > TABLES IN SCHEMA s1);
> > CREATE PUBLICATION pub FOR TABLES IN SCHEMA s1 EXCEPT (TABLE t1, TABLE
> > t2), TABLE t3;
> >
> > While this approach is workable, a downside is the repeated use of the
> > TABLE keyword inside the parentheses, which can become verbose. But it
> > can then be optimized to have:
> >
> > CREATE PUBLICATION pub FOR ALL TABLES EXCEPT (TABLE t1, t2, t3);
> >
> > This could be extended further in the future:
> >
> > CREATE PUBLICATION pub FOR ALL TABLES EXCEPT (TABLE t1, t2, TABLES IN
> > SCHEMA s1, s2);
> >
> > This approach gives users flexibility to mix styles, for example:
> >
> > EXCEPT (TABLE t1, TABLE t2, TABLE t3)
> > EXCEPT (TABLE t1, t2, t3)
> > EXCEPT (TABLE t1, t2, TABLE t3)
> > EXCEPT (TABLE t1, TABLES IN SCHEMA s1, s2, TABLE t2, t3)
> >
> > While flexible, this can reduce clarity due to mixed styles, making
> > the statement harder to read. If extended further, the syntax could
> > evolve into something like:
> >
> > CREATE PUBLICATION pub1 FOR
> > ALL TABLES
> > EXCEPT (TABLE t1, t2, TABLES IN SCHEMA s1, s2),
> > ALL SEQUENCES
> > EXCEPT (SEQUENCE s1);
> >
> > At this point, one might also question why not allow something like:
> > FOR ALL (TABLES, SEQUENCES).
> >
> > Additionally, this shows a potential drift toward less structured
> > syntax. Instead, with the syntax already implemented in [1], its
> > future extension would look like:
> >
> > CREATE PUBLICATION pub1 FOR
> > ALL TABLES
> > EXCEPT TABLE (t1, t2),
> > EXCEPT TABLES IN SCHEMA (s1, s2),
> > ALL SEQUENCES
> > EXCEPT SEQUENCE (seq1, seq2);
> >
> > Although slightly more verbose, this approach keeps each clause
> > self-contained and explicit. The meaning of each part is determined
> > locally, rather than depending on elements appearing far in the
> > statement.
> >
> > The current syntax in [1] is simple and easy to follow. We have
> > retained the current implementation for now, while remaining open to
> > further discussion and suggestions.
> >
> > [1]:
> > https://www.postgresql.org/message-id/CALDaNm2-Ob9qPR%2BvqUSVMkxYO8RW4LQ_S1XiB0Y7xa54U%3DDqbA%40mail.gmail.com
> > https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=fd366065e06ae953c4f2d973d5c5f0474f3b87b6
> >
> > [2]: https://www.postgresql.org/message-id/CAJpy0uB20MhJJEaPJdm31t4fykJ%2BfChA_76jU2P9HX5knbJvAA%40mail.gmail.com
>
>
> Thanks for the summary. While I find the current implementation
> simpler and more intuitive, and would prefer it if we were designing
> this from scratch, we must consider the existing patterns for table
> inclusion. Since the inclusion syntax already supports a mixed
> approach, users will likely expect the same flexibility for
> exclusions. For the sake of consistency across the features, I believe
> we should move toward the mixed approach, despite my preference for
> the current structured style.
>
IIUC, you think that we should change the current syntax "CREATE
PUBLICATION pub FOR ALL TABLES EXCEPT TABLE (a, b, c);" to "CREATE
PUBLICATION pub FOR ALL TABLES EXCEPT (TABLE a, b, c);".
By now multiple people (Dilip Kumar, Peter Smith, Sawada Masahiko)
have preferred the alternate syntax, to move TABLE inside () to make
specifying inclusion and exclusion list in a similar way. Unless we
have more feedback, I think we can change it now.
--
With Regards,
Amit Kapila.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shveta malik | 2026-03-26 06:33:15 | Re: synchronized_standby_slots behavior inconsistent with quorum-based synchronous replication |
| Previous Message | Ashutosh Sharma | 2026-03-26 06:05:37 | Re: synchronized_standby_slots behavior inconsistent with quorum-based synchronous replication |