| From: | Nisha Moond <nisha(dot)moond412(at)gmail(dot)com> |
|---|---|
| To: | Peter Smith <smithpb2250(at)gmail(dot)com> |
| Cc: | 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-06-22 12:49:41 |
| Message-ID: | CABdArM6Vv9Z4Dyj3+Wvdcq_8AAL2PshoHObZhpi5aBRkRn1eQA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Jun 22, 2026 at 7:46 AM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> Hi Nisha.
>
> No further comments for patches v15-0001,0002,0003.
>
> But, here are some comments for v15-0004.
>
> ======
> doc/src/sgml/ref/alter_publication.sgml
>
> 1.
> + <para>
> + For <literal>FOR TABLES IN SCHEMA</literal> publications, the
> + <literal>EXCEPT</literal> clause is schema-scoped. If a table listed in
> + the <literal>EXCEPT</literal> clause is later moved to a different schema
> + using <command>ALTER TABLE ... SET SCHEMA</command>, the exclusion is
> + removed; the table will then be published if its new schema is part of a
> + publication. If the table is subsequently moved back to the original
> + schema, the exclusion is not restored, and must be re-established
> + explicitly using <command>ALTER PUBLICATION</command>.
> + </para>
>
> IIRC the recent commit 77b6dd9 that explained about moving tables to
> other schemas, was only on the CREATE PUBLICATION page; not on the
> ALTER PUBLICATION page.
>
> So either:
> (a) maybe this entire paragraph is not needed, or
> (b) keep it, but then the behaviour for FOR ALL TABLES also needs to
> be described here
>
> ======
> doc/src/sgml/ref/alter_publication.sgml
>
> 2.
> Once a table is excluded, the exclusion applies to that table
> regardless of its name or schema. Renaming the table or moving it to
> another schema using ALTER TABLE ... SET SCHEMA does not remove the
> exclusion.
>
> ~~
>
> The recent commit 77b6dd9 added the above text to the CREATE
> PUBLICATION page. But, that was correct only for "FOR ALL TABLES" --
> after your patch we can't say that unconditionally anymore. Also,
> since that is mentioned on the CREATE PUBLICATION page, I guess we
> need to say something similar about ALL TABLES IN SCHEMA ... EXCEPT in
> the same paragraph.
>
> So, maybe something like below:
>
> SUGGESTION
> Once a table is excluded under <literal>FOR ALL TABLES</literal>, the
> exclusion applies to that table, the exclusion applies to that table
> regardless of its name or schema. Renaming the table or moving it to
> another schema using <command>ALTER TABLE ... SET SCHEMA</command>
> does not remove the exclusion. However, for <literal>FOR TABLES IN
> SCHEMA</literal>, because the <literal>EXCEPT</literal> is
> schema-scoped, moving a schema-excluded table to another schema does
> remove the exclusion.
>
Based on the changes in commit 77b6dd9, I re-analyzed the pointed-out paragraph.
On reconsideration, I think the schema-move behavior is really a
property of EXCEPT itself rather than ALTER PUBLICATION. So we can
keep it only in the CREATE PUBLICATION documentation and drop it from
ALTER PUBLICATION to avoid duplication.
We already have a cross-reference in ALTER PUBLICATION: "See CREATE
PUBLICATION for further details on the semantics of EXCEPT", so users
still have a clear path to the detailed behavior description.
I modified your suggestion slightly to keep the information from the
removed paragraph intact.
Attached updated patches v16. No changes in 0001 to 0003.
--
Thanks,
Nisha
| Attachment | Content-Type | Size |
|---|---|---|
| v16-0001-Support-EXCEPT-clause-for-schema-level-publicati.patch | application/octet-stream | 60.3 KB |
| v16-0002-Add-EXCEPT-support-to-ALTER-PUBLICATION-ADD-TABL.patch | application/octet-stream | 18.6 KB |
| v16-0003-Add-EXCEPT-support-to-ALTER-PUBLICATION-SET-TABL.patch | application/octet-stream | 23.2 KB |
| v16-0004-Documentation-Patch.patch | application/octet-stream | 10.9 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ewan Young | 2026-06-22 12:49:54 | Re: REPACK CONCURRENTLY fails on tables with generated columns |
| Previous Message | Akshay Joshi | 2026-06-22 12:40:53 | Re: [PATCH] Add pg_get_table_ddl() to reconstruct CREATE TABLE statements |