Re: Support EXCEPT for TABLES IN SCHEMA publications

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Nisha Moond <nisha(dot)moond412(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-01 07:26:14
Message-ID: CAHut+PujTD8NY56HsOiWwDd8N1UVR2dW-_sVexoN8qeNqwNCtQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Nisha.

Some review comments for patch v8-0003.

======
src/backend/commands/publicationcmds.c

AlterPublicationSchemaExceptTables:

1.
+ /*
+ * EXCEPT is not meaningful with DROP: dropping a schema from a
+ * publication already removes all its except entries via cascade, and
+ * there is no sensible interpretation of "drop only the except entry but
+ * keep the schema".
+ */

Is that backwards? I think you mean :

SUGGESTION
* Dropping a schema from a publication removes all its EXCEPT entries via
* cascade. The concept of "drop all schema tables from the publication EXCEPT
* these ones" is not supported.
======
src/bin/pg_dump/t/002_pg_dump.pl

2.
On Sat, May 30, 2026 at 2:32 PM Nisha Moond <nisha(dot)moond412(at)gmail(dot)com> wrote:
...
> I don't see any existing "..test continues..." pattern, so I changed it as -
> 'CREATE PUBLICATION pub11 - ADD TABLES IN SCHEMA EXCEPT dump'
>
> Thoughts?

I've since found that there is a way to combine multiple regex within
a single test. Doing it like below is a cleaner way to write these
multi-statement tests.

SUGGESTION (note /xms instead of /xm)
'CREATE PUBLICATION pub11' => {
create_order => 50,
create_sql =>
'CREATE PUBLICATION pub11 FOR TABLES IN SCHEMA dump_test
EXCEPT (TABLE test_table);',
regexp => qr/^
\QCREATE PUBLICATION pub11 WITH (publish = 'insert,
update, delete, truncate');\E
.*?
\QALTER PUBLICATION pub11 ADD TABLES IN SCHEMA dump_test
EXCEPT (TABLE ONLY test_table);\E
/xms,
like => { %full_runs, section_post_data => 1, },
},

(ditto for the pub12 test)

======
Kind Regards,
Peter Smith.
Fujitsu Australia

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2026-06-01 07:28:53 Re: Support EXCEPT for TABLES IN SCHEMA publications
Previous Message Peter Smith 2026-06-01 07:24:07 Re: Support EXCEPT for TABLES IN SCHEMA publications