Re: BUG #19434: adding WHERE to a publication can cause UPDATEs and DELETEs to fail on the source table - Mailing list pgsql-bugs

From Tim McLaughlin
Subject Re: BUG #19434: adding WHERE to a publication can cause UPDATEs and DELETEs to fail on the source table
Date
Msg-id CAA6J38LaBbDa5+9kng8R=nBQksqvtFqwoPfE-0z8if4GhLp9ww@mail.gmail.com
Whole thread
In response to Re: BUG #19434: adding WHERE to a publication can cause UPDATEs and DELETEs to fail on the source table  (Greg Sabino Mullane <htamfids@gmail.com>)
List pgsql-bugs
Greg,
I'm actually working on another project that uses CDC for fraud detection and it occurred to me that it would be really great if there was an explicit way to just add a column to the "important columns" in general when the table is added to a publication.  I'm currently using a pg_logical_embed_message to do it, but it would be a lot cleaner if there was something like this:
ALTER PUBLICATION mypublication ADD TABLE users (user_id, firstname) 
INCLUDE (account_id) WHERE (status = 'ACTIVE');
It would effectively then have account_id & status always included in the NEW column.

Cheers,
Tim


On Mon, Mar 23, 2026 at 12:47 PM Greg Sabino Mullane <htamfids@gmail.com> wrote:
I don't think this is really a bug, more of a feature request / optimization. However, I do agree this is an important one. I don't see offhand why we can't append the where list to our existing list of important columns. There would be a few downsides, but none that would be worse than going full replica identity or creating a new index. I'll see about making a proof of concept patch and throwing it on -hackers. Will cc you on that.

Cheers,
Greg

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #19450: Where is checksum_block.inc.c after master install?
Next
From: Dmitriy Kuzmin
Date:
Subject: Re: BUG #19437: temp_tablespaces doesn't work inside a cursor?