Re: Support EXCEPT for ALL SEQUENCES publications

From: shveta malik <shveta(dot)malik(at)gmail(dot)com>
To: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
Cc: vignesh C <vignesh21(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Smith <smithpb2250(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>
Subject: Re: Support EXCEPT for ALL SEQUENCES publications
Date: 2026-06-29 10:32:16
Message-ID: CAJpy0uDv7mDc=MqTP-QXWZcRM_m-MW-wYtRh3xwqD0sm-F+=Pw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 26, 2026 at 6:08 PM Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com> wrote:
>
> I have addressed all the comments. I have also addressed the comments
> by Peter in [1].
> Please find the updated v14 patch.
>
> [1]: https://www.postgresql.org/message-id/CAHut%2BPsgCQa2hcT8TNqejV3y4U5ouj%3DZCOLMxgVGvBrUEkLaKg%40mail.gmail.com

Thanks, a few trivial comments:

001:
1)
PublicationRelation

+typedef struct PublicationRelation
{
NodeTag type;
RangeVar *relation; /* publication relation */
Node *whereClause; /* qualifications */
List *columns; /* List of columns in a publication table */
bool except; /* True if listed in the EXCEPT clause */
-} PublicationTable;
+} PublicationRelation;

Can we make comments more clear. Suggestion:

typedef struct PublicationRelation
{
NodeTag type;
RangeVar *relation; /* publication table/sequence */
Node *whereClause; /* qualifications for publication table */
List *columns; /* List of columns in a publication table */
bool except; /* True if listed in the EXCEPT clause */
} PublicationRelation;

002:
2)
+ if ((pubrelkind == RELKIND_RELATION && relkind == RELKIND_RELATION) ||
+ (pubrelkind == RELKIND_RELATION && relkind == RELKIND_PARTITIONED_TABLE) ||
+ (pubrelkind == RELKIND_SEQUENCE && relkind == RELKIND_SEQUENCE))

Can we optimize it to:
if ((pubrelkind == RELKIND_RELATION &&
(relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE)) ||
(pubrelkind == RELKIND_SEQUENCE && relkind == RELKIND_SEQUENCE))

3)
+-- Modify the sequence list in the EXCEPT clause
+ALTER PUBLICATION regress_pub_forallsequences3 SET ALL SEQUENCES
EXCEPT (SEQUENCE regress_pub_seq0);

After this or at the end, can we add a testcase for 'SET ALL
SEQUENCES' to cover the reset except-seq code-flow.

thanks
Shveta

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Henson Choi 2026-06-29 10:36:05 Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions
Previous Message warda Bibi 2026-06-29 10:21:23 Re: Additional message in pg_terminate_backend