Re: Skipping schema changes in publication

From: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(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-27 20:49:34
Message-ID: CANhcyEUQvEK+HOH6Y8Fy30fNvC631ZopWKhwgskXjKnuXiGV5Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 27 Mar 2026 at 18:04, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Fri, Mar 27, 2026 at 1:20 PM Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)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

Attachment Content-Type Size
v3-0001-Change-syntax-of-EXCEPT-TABLE-clause-in-publicati.patch application/octet-stream 47.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Shlok Kyal 2026-03-27 20:50:57 Re: Skipping schema changes in publication
Previous Message Alexander Borisov 2026-03-27 20:37:39 Re: Improve the performance of Unicode Normalization Forms.