Re: Skipping schema changes in publication

Chao Li <li.evan.chao@gmail.com>

From: Chao Li <li.evan.chao@gmail.com>
To: vignesh C <vignesh21@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>, Shlok Kyal <shlok.kyal.oss@gmail.com>, Ashutosh Sharma <ashu.coek88@gmail.com>, shveta malik <shveta.malik@gmail.com>, "David G. Johnston" <david.g.johnston@gmail.com>, Dilip Kumar <dilipbalaut@gmail.com>, Peter Smith <smithpb2250@gmail.com>, "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>, YeXiu <1518981153@qq.com>, Ian Lawrence Barwick <barwick@gmail.com>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-02-25T08:22:37Z
Lists: pgsql-hackers

> On Feb 25, 2026, at 15:04, vignesh C <vignesh21@gmail.com> wrote:
> 
> On Mon, 23 Feb 2026 at 16:46, Amit Kapila <amit.kapila16@gmail.com> wrote:
>> 
>> On Mon, Feb 23, 2026 at 11:37 AM Shlok Kyal <shlok.kyal.oss@gmail.com> wrote:
>>> 
>>> I have also modified the error message as suggested by Shveta in [2].
>>> Attached the latest v48 patch.
>>> 
>> 
>> I see that the second patch (0002) brings complexity in the patch to
>> deal with following points: (a) The first complexity is if one of the
>> partitions is specified then how to compute the initial set of
>> relations to copy when pubviaroot is true. This is complex because we
>> need to exclude the partitions specified. (b) The other complexity is
>> combining Except list containing partitions and other publications
>> specifying partitions or partitioned tables both during replication
>> and probably during initial sync.
>> 
>> I think it will be better if for the first version, we allow only root
>> partitioned table to be specified in the Except Table list. This would
>> mean that if the user tries to attach that root partition table to
>> another root then we should give an error. If we go via this route, it
>> will be important to allow users to remove some tables from the Except
>> list, so we can provide Alter Publication <pub_name> Set Except Table
>> (table_names).
> 
> The attached patch has the changes for the same i.e.a) Raises an error
> when attempting to attach a partition to a root partitioned table if
> that table is referenced in an EXCEPT clause of any publication. b)
> Adds support for dropping excluded tables using: ALTER PUBLICATION ...
> DROP EXCEPT TABLE. c) Adds support for replacing the exclusion list
> using  ALTER PUBLICATION ... SET EXCEPT TABLE.
> The changes related to DROP EXCEPT TABLE and SET EXCEPT TABLE have
> been kept separately into patch 0002 for easier review.
> 
> The comments from [1] are also addressed in the attached patch.
> [1] - https://www.postgresql.org/message-id/CAA4eK1KESu4%3DW6j4CQkKv5nzNJgtJyYBsg3E5K%2BLcwOr3t0WKw%40mail.gmail.com
> 
> Regards,
> Vignesh
> <v49-0001-Skip-publishing-the-tables-specified-in-EXCEPT-T.patch><v49-0002-Support-DROP-and-SET-EXCEPT-TABLE-in-ALTER-PUBLI.patch>

I quickly went through the code change and haven’t actually played the new feature yet. A few small comments:

1 - 0001 - subscriptioncmds.c
```
+	GetPublicationsStr(except_publications, &pubnames, false);
+
+	pfree(except_publications);
```

except_publications is a list, so we should use list_free(except_publications) instead of pfree().

2 - 0002
```
+   will be removed.  The <literal>ADD</literal> clauses will add one or more
+   tables/schemas from the publication.  The <literal>DROP</literal> clauses
```

I guess “from the publication” should be “to the publication”.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/







Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix miscellaneous issues in EXCEPT publication clause.

  2. Change syntax of EXCEPT TABLE clause in publication commands.

  3. Add support for EXCEPT TABLE in ALTER PUBLICATION.

  4. Allow table exclusions in publications via EXCEPT TABLE.

  5. Add wait_for_subscription_sync for TAP tests.