Re: Support EXCEPT for TABLES IN SCHEMA publications

From: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: shveta malik <shveta(dot)malik(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Support EXCEPT for TABLES IN SCHEMA publications
Date: 2026-06-02 08:56:18
Message-ID: CABdArM56e15Qa+Z9xX7kkinZR2rxkc2=r-QAisFvKg+Bf2sa_g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jun 1, 2026 at 12:54 PM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> Hi Nisha.
>
> Review comments for v8-0001 and v8-0002.
>

Thanks for the review.

> ======
> git apply gives warnings.
>
> 1.
> git apply ../patches_misc/v8-0001-Support-EXCEPT-clause-for-schema-level-publicatio.patch
> ../patches_misc/v8-0001-Support-EXCEPT-clause-for-schema-level-publicatio.patch:176:
> space before tab in indent.
> errmsg("relation \"%s\" is
> already member of publication \"%s\"",
> warning: 1 line adds whitespace errors.
>
> ======
> src/bin/psql/tab-complete.in.c
>
> On Sat, May 30, 2026 at 2:32 PM Nisha Moond <nisha(dot)moond412(at)gmail(dot)com> wrote:
> >
> ...
> > > 9.
> > > BTW, the current code is not able to handle multiple schemas.
> > >
> > > So, this works:
> > > test_pub=# CREATE PUBLICATION pub1 for TABLES IN SCHEMA myschema <TAB>
> > > EXCEPT ( TABLE WITH (
> > >
> > > but, this doesn't do anything:
> > > test_pub=# CREATE PUBLICATION pub1 for TABLES IN SCHEMA public, myschema <TAB>
> > >
> >
> > I think the above preserves the existing behavior. Currently, we do
> > not suggest "WITH (" after the second schema onwards. To support this
> > properly, we would also need to handle "WITH (" suggestions for
> > subsequent schema entries.
> >
> > I’ve created a top-up patch (patch-002) for this. I can merge it if we
> > want to change the current behavior. Let me know your thoughts.
>
> 2.
> Some scenarios are improved, but others do not work (either newly
> broken or maybe they have been?).
>

I tested these scenarios on HEAD (without this patch), and most of
them already exist today. (See inline below).

> TBH, I am unsure if the added complexity of patch 0002 was worth it. I
> am going to pass on this for now and wait for other opinions.
>
> e.g.
>
> Good: (suggests schemas to use)
> test_pub=# CREATE PUBLICATION pub1 FOR TABLES IN SCHEMA
> CURRENT_SCHEMA information_schema myschema public
>

Not introduced by this patch; it is existing behavior.

> Bad: (does not suggest more schema to use)
> test_pub=# CREATE PUBLICATION pub1 FOR TABLES IN SCHEMA public, <TAB HERE>
>

Not introduced by this patch; it is existing behavior.

> Good: (completes names of known schema)
> test_pub=# CREATE PUBLICATION pub1 FOR TABLES IN SCHEMA my <TAB HERE>
> becomes
> test_pub=# CREATE PUBLICATION pub1 FOR TABLES IN SCHEMA myschema
>

Not introduced by this patch; it is existing behavior.

> Bad: (does not complete names of known schema)
> test_pub=# CREATE PUBLICATION pub1 FOR TABLES IN SCHEMA public, my <TAB HERE>
>

Not introduced by this patch; it is existing behavior.

> Good: (suggest EXCEPT with single schema)
> test_pub=# CREATE PUBLICATION pub1 FOR TABLES IN SCHEMA myschema
> EXCEPT ( TABLE WITH (
>

This behavior is introduced by v8-0001.

> Good: (suggest EXCEPT with multi schema)
> test_pub=# CREATE PUBLICATION pub1 for TABLES IN SCHEMA public, myschema
> EXCEPT ( TABLE WITH (
>

This behavior is introduced by v8-0002.

> Bad: (doesn't work if the FOR TABLE precedes TABLES IN SCHEMA)
> test_pub=# CREATE PUBLICATION pub1 FOR TABLE mytab, TABLES IN <TAB HERE>

Not introduced by this patch; it is existing behavior.
~~~

All of the above behavior is consistent with HEAD. Only the "EXCEPT
(TABLE" suggestions are introduced by patches 0001 and 0002.

I'm also not sure the added complexity is justified just for the
"EXCEPT (TABLE" suggestion, especially since suggestions after commas
are generally not supported in most existing cases.
I'll drop patch-0002 for now and we can revisit it later if others
have opinions on it.

--
Thanks,
Nisha

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nisha Moond 2026-06-02 08:56:49 Re: Support EXCEPT for TABLES IN SCHEMA publications
Previous Message Jelte Fennema-Nio 2026-06-02 08:31:36 Re: PostgreSQL 19 Beta 1 release announcement draft