Re: bogus: logical replication rows/cols combinations
Tomas Vondra <tomas.vondra@enterprisedb.com>
From: Tomas Vondra <tomas.vondra@enterprisedb.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>,
Peter Eisentraut <peter.eisentraut@enterprisedb.com>,
Pg Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-05-02T18:37:59Z
Lists: pgsql-hackers
On 5/2/22 13:23, Amit Kapila wrote: > On Mon, May 2, 2022 at 3:05 PM Tomas Vondra > <tomas.vondra@enterprisedb.com> wrote: >> >> On 5/2/22 07:31, Amit Kapila wrote: >>> On Mon, May 2, 2022 at 3:27 AM Tomas Vondra >>> <tomas.vondra@enterprisedb.com> wrote: >>>> >> >>>> The second option has the annoying consequence that it makes this >>>> useless for the "data redaction" use case I described in [2], because >>>> that relies on combining multiple publications. >>>> >>> >>> True, but as a workaround users can create different subscriptions for >>> different publications. >>> >> >> Won't that replicate duplicate data, when the row filters re not >> mutually exclusive? >> > > True, but this is a recommendation for mutually exclusive data, and as > far as I can understand the example given by you [1] and Alvaro has > mutually exclusive conditions. In your example, one of the > publications has a condition (region = 'USA') and the other > publication has a condition (region != 'USA'), so will there be a > problem in using different subscriptions for such cases? > I kept that example intentionally simple, but I'm sure we could come up with more complex use cases. Following the "data redaction" idea, we could also apply the "deny all" approach, and do something like this: -- replicate the minimal column list by default (replica identity) CREATE PUBLICATION p1 FOR TABLE t (id, region); -- replicate more columns for the selected region CREATE PUBLICATION p2 FOR TABLE t (...) WHERE (region = 'USA') Now, I admit this is something I just made up, but I think it seems like a pretty common approach. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Prohibit combining publications with different column lists.
- fd0b9dcebda7 15.0 landed
-
Extend pg_publication_tables to display column list and row filter.
- 0ff20288e1cb 15.0 landed
-
Remove dynamic_shared_memory_type=none
- bcbd940806a2 12.0 cited