Re: Skipping schema changes in publication

From: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, YeXiu <1518981153(at)qq(dot)com>, Ian Lawrence Barwick <barwick(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Skipping schema changes in publication
Date: 2025-06-17 07:41:34
Message-ID: CANhcyEXspT3v5-Tdop9uqQV2HWBvZoN5P0BxXQ6Md6Mr7GXK9A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 11 Jun 2025 at 19:37, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com> wrote:
>
> On Thu, 17 Apr 2025 at 09:12, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > On Wed, Apr 16, 2025 at 8:22 AM Zhijie Hou (Fujitsu)
> > <houzj(dot)fnst(at)fujitsu(dot)com> wrote:
> > >
> > > On Thu, Apr 10, 2025 at 7:25 PM Amit Kapila wrote:
> > > >
> > > > On Tue, Jan 9, 2024 at 12:02 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
> > > > >
> > > > > As I did not see much interest from others, I'm withdrawing this patch
> > > > > for now. But if there is any interest others in future, I would be
> > > > > more than happy to work on this feature.
> > > > >
> > > >
> > > > Just FYI, I noticed a use case for this patch in email [1]. Users would like to
> > > > replicate all except a few columns having sensitive information. The challenge
> > > > with current column list features is that adding new tables to columns would
> > > > lead users to change the respective publications as well.
> > > >
> > > > [1] -
> > > > https://www.postgresql.org/message-id/tencent_DCDF626FCD4A556C51BE
> > > > 270FDC3047540208%40qq.com
> > >
> > > BTW, I noticed that debezium, an open source distributed platform for change
> > > data capture that replies on logical decoding, also support specifying the
> > > column exclusion list[1]. So, this indicates that there could be some use cases
> > > for this feature.
> > >
> >
> > Thanks for sharing the link. I see that they support both the include
> > and exclude lists for columns and tables.
> >
>
> Hi Hackers,
>
> I see there is some interest in the functionality added by this patch.
> I have rebased the patches in [1]. I saw a new column 'pubgencols' was
> added in pg_publication in PG 18. So, I have modified v11-0001 to
> RESET this as well.
> I am also working on creating a patch to exclude columns in
> publication as per suggestion in [2].
>
> [1]: https://www.postgresql.org/message-id/CALDaNm3dWZCYDih55qTNAYsjCvYXMFv%3D46UsDWmfCnXMt3kPCg%40mail.gmail.com
> [2]: https://www.postgresql.org/message-id/CAA4eK1KRdAPC%3D5%3D7tQ1GW0cRwD%3DzaDMi%2BT4u_k4GxPhPY6e8BQ%40mail.gmail.com
>

I have attached a patch support excluding columns for publication.

I have added a syntax: "FOR TABLE table_name EXCEPT (c1, c2, ..)"
It can be used with CREATE or ALTER PUBLICATION.

v12-0003 patch contains the changes for the same.

Thanks and Regards,
Shlok Kyal

Attachment Content-Type Size
v12-0001-Add-RESET-clause-to-Alter-Publication-which-will.patch application/octet-stream 20.5 KB
v12-0002-Skip-publishing-the-tables-specified-in-EXCEPT-T.patch application/octet-stream 68.8 KB
v12-0003-Skip-publishing-the-columns-specified-in-FOR-TAB.patch application/octet-stream 45.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-06-17 07:43:13 Re: pg_dump/pg_dumpall help synopses and terminology
Previous Message Yugo Nagata 2025-06-17 07:35:28 Re: Suggestion to add --continue-client-on-abort option to pgbench