Re: Support EXCEPT for TABLES IN SCHEMA publications

From: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>
To: shveta malik <shveta(dot)malik(at)gmail(dot)com>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Support EXCEPT for TABLES IN SCHEMA publications
Date: 2026-07-23 11:56:43
Message-ID: CABdArM7YBCpzES8K=i-X833WCOdzjA9S9t-7=U4v5wA5s2eCPQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 21, 2026 at 11:12 AM shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
>
>
> A few more comments:
>
> 8)
> CreatePublication:
> + /*
> + * Collect explicit table OIDs now, before we close the relation
> + * list, so that except-table validation below can check for
> + * contradictions without relying on a catalog scan that might not
> + * yet see the just-inserted rows.
> + */
> + if (except_pubtables != NIL)
> + {
> + foreach_ptr(PublicationRelInfo, pri, rels)
> + explicitrelids = lappend_oid(explicitrelids,
> + RelationGetRelid(pri->relation));
> + }
> +
> PublicationAddTables(puboid, rels, true, NULL);
>
> Shall we make the explicitrelids collection after
> 'PublicationAddTables', as PublicationAddTables may error out too
> while doing 'check_publication_add_relation'.
>

make sense. Updated.

> 9)
> In the check above, IIUC, except_pubtables can be there even for ALL
> TABLES, but we want this handling only for schema-except list, so
> shall we have the check as:
>
> if (schemaidlist != NIL && except_pubtables != NIL)
>

Here FOR ALL TABLES EXCEPT is already handled in the for_all_tables
branch, so it can't reach this code.

The only possible cases here are FOR TABLE and FOR TABLES IN SCHEMA.
Since EXCEPT is not supported with plain FOR TABLE, except_pubtables
!= NIL already implies the schema case.

That said, should we add an assertion here, e.g.:

if (except_pubtables != NIL)
{
/* EXCEPT is only accepted with TABLES IN SCHEMA */
Assert(schemaidlist != NIL);
...

Or please correct me if I've misunderstood something.

--
Thanks,
Nisha

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2026-07-23 12:02:08 Re: hashjoins vs. Bloom filters (yet again)
Previous Message Nisha Moond 2026-07-23 11:56:20 Re: Support EXCEPT for TABLES IN SCHEMA publications