Re: Skipping schema changes in publication
vignesh C <vignesh21@gmail.com>
From: vignesh C <vignesh21@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>,
Peter Smith <smithpb2250@gmail.com>, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>,
shveta malik <shveta.malik@gmail.com>, Shlok Kyal <shlok.kyal.oss@gmail.com>,
Nisha Moond <nisha.moond412@gmail.com>, Ashutosh Sharma <ashu.coek88@gmail.com>,
"David G. Johnston" <david.g.johnston@gmail.com>, Dilip Kumar <dilipbalaut@gmail.com>,
"Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>, YeXiu <1518981153@qq.com>, Ian Lawrence Barwick <barwick@gmail.com>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-03-15T12:25:34Z
Lists: pgsql-hackers
Attachments
- v63-0001-Add-support-for-EXCEPT-TABLE-in-ALTER-PUBLICATIO.patch (application/octet-stream) patch v63-0001
- v63-0002-Change-syntax-of-CREATE-PUBLICATION-.-FOR-ALL-TA.patch (application/octet-stream) patch v63-0002
On Sat, 14 Mar 2026 at 15:05, Amit Kapila <amit.kapila16@gmail.com> wrote: > > On Fri, Mar 13, 2026 at 11:51 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote: > > > > On Fri, Mar 13, 2026 at 2:51 AM Amit Kapila <amit.kapila16@gmail.com> wrote: > > > > > > On Fri, Mar 13, 2026 at 8:55 AM Peter Smith <smithpb2250@gmail.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. +1 to proceed with completing the pending work. I implemented the suggested new syntax, and it only requires a few lines of code changes. I evaluated the change to ensure there is no additional complexity, and it appears straightforward. We can switch to the new syntax once we gather a few more opinions and finalize it. The attached 0002 patch includes the corresponding changes. Regards, Vignesh
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix miscellaneous issues in EXCEPT publication clause.
- 6b0550c45d13 19 (unreleased) landed
-
Change syntax of EXCEPT TABLE clause in publication commands.
- 5984ea868eee 19 (unreleased) landed
-
Add support for EXCEPT TABLE in ALTER PUBLICATION.
- 493f8c6439cf 19 (unreleased) landed
-
Allow table exclusions in publications via EXCEPT TABLE.
- fd366065e06a 19 (unreleased) landed
-
Add wait_for_subscription_sync for TAP tests.
- 0c20dd33db16 16.0 cited