On Fri, 27 Mar 2026 at 18:04, Amit Kapila <[email protected]> wrote:
>
> On Fri, Mar 27, 2026 at 1:20 PM Shlok Kyal <[email protected]> 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_f3wr...@mail.gmail.com

Thanks,
Shlok Kyal

Attachment: v3-0001-Change-syntax-of-EXCEPT-TABLE-clause-in-publicati.patch
Description: Binary data

Reply via email to