Re: Skipping schema changes in publication
Shlok Kyal <shlok.kyal.oss@gmail.com>
From: Shlok Kyal <shlok.kyal.oss@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Peter Smith <smithpb2250@gmail.com>, vignesh C <vignesh21@gmail.com>, Dilip Kumar <dilipbalaut@gmail.com>, shveta malik <shveta.malik@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>,
Nisha Moond <nisha.moond412@gmail.com>, Ashutosh Sharma <ashu.coek88@gmail.com>,
"David G. Johnston" <david.g.johnston@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-27T20:49:34Z
Lists: pgsql-hackers
Attachments
- v3-0001-Change-syntax-of-EXCEPT-TABLE-clause-in-publicati.patch (application/octet-stream) patch v3-0001
On Fri, 27 Mar 2026 at 18:04, Amit Kapila <amit.kapila16@gmail.com> wrote:
>
> On Fri, Mar 27, 2026 at 1:20 PM Shlok Kyal <shlok.kyal.oss@gmail.com> wrote:
> >
> > I have addressed the comments. Attached the updated patch.
> >
>
> I got following crash:
>
> postgres=# create publication pub1 for all tables except (t1, t2);
> server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.
> The connection to the server was lost. Attempting reset: Failed.
>
> Server Log:
> ERROR: syntax error at or near "table" at character 47
> [client backend] STATEMENT: create publication pub1 for all tables
> except table (t1, t2);
> TRAP: failed Assert("pubobj->pubobjtype ==
> PUBLICATIONOBJ_EXCEPT_TABLE"), File: "../src/backend/parser/gram.y",
> Line: 20795, PID: 7512
> abort() has been called[postmaster] LOG: client backend (PID 7512)
> was terminated by exception 0xC0000409
> [postmaster] DETAIL: Failed process was running: create publication
> pub1 for all tables except (t1, t2);
> [postmaster] HINT: See C include file "ntstatus.h" for a description
> of the hexadecimal value.
This crash is happening because we hit the Assert(pubobj->pubobjtype
== PUBLICATIONOBJ_EXCEPT_TABLE).
In the above example the first table is specified without the TABLE
keyword and hence its pubobjtype is PUBLICATIONOBJ_CONTINUATION.
I have updated the Assert and also added a test case for the above scenario.
>
> BTW, why do we need preprocess_except_pubobj_list?
>
It is needed to check if the first table in the EXCEPT list is
specified with TABLE Keyword.
For example: create publication pub1 for all tables except (t1, t2);
This should throw an error because t1 is specified without the TABLE keyword.
We have a similar logic for FOR TABLE or FOR TABLES IN SCHEMA
publications in 'preprocess_pubobj_list'
I have attached the latest version here. I have also addressed the
comment shared by Shveta in [1].
[1]: https://www.postgresql.org/message-id/CAJpy0uCMhxUdEZMqDuSHXeAMES1gH56r-tkhR1J79A_f3wrLkg@mail.gmail.com
Thanks,
Shlok Kyal
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