Re: row filtering for logical replication - Mailing list pgsql-hackers

From Ajin Cherian
Subject Re: row filtering for logical replication
Date
Msg-id CAFPTHDahugndFR+61zOah-69a=sg5ATKcTMxNzaULjKAS9L=Tw@mail.gmail.com
Whole thread Raw
In response to RE: row filtering for logical replication  ("houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>)
List pgsql-hackers
On Mon, Dec 20, 2021 at 12:51 PM houzj.fnst@fujitsu.com
<houzj.fnst@fujitsu.com> wrote:
>
> I think it might not be hard to predict the current behavior. User only need to be
> aware of that:
> 1) pubaction and row filter on different publications are combined with 'OR'.
> 2) FOR UPDATE, we execute the fiter for both OLD and NEW tuple and would change
>    the operation type accordingly.
>
> For the example mentioned:
> create table tbl1 (a int primary key, b int);
> create publication A for table tbl1 where (b<2) with(publish='insert');
> create publication B for table tbl1 where (a>1) with(publish='update');
>
> If we follow the rule 1) and 2), I feel we are able to predict the following
> conditions:
> --
> WHERE (action = 'insert' AND b < 2) OR (action = 'update' AND a > 1)
> --
>
> So, it seems acceptable to me.
>
> Personally, I think the current design could give user more flexibility to
> handle some complex scenario. If user want some simple setting for publication,
> they can also set same row filter for the same table in different publications.
> To avoid confusion, I think we can document about these rules clearly.
>
> BTW, From the document of IBM, I think IBM also support this kind of complex
> condition [1].
> [1] https://www.ibm.com/docs/en/idr/11.4.0?topic=rows-log-record-variables

Yes, I agree with this. It's better to give users more flexibility
while warning him on what the consequences are rather than restricting
him with constraints.
We could explain this in the documentation so that users can better
predict the effect of having pubaction specific filters.

regards,
Ajin Cherian
Fujitsu Australia



pgsql-hackers by date:

Previous
From: "wangw.fnst@fujitsu.com"
Date:
Subject: RE: Confused comment about drop replica identity index
Next
From: Amit Kapila
Date:
Subject: Re: parallel vacuum comments