Re: pg_get_publication_tables() output duplicate relid - Mailing list pgsql-hackers
From | Amit Kapila |
---|---|
Subject | Re: pg_get_publication_tables() output duplicate relid |
Date | |
Msg-id | CAA4eK1K8_NJCjBEj2-CXvZLCS9FPJtepr48Qx0QR=YSXr=hU-g@mail.gmail.com Whole thread Raw |
In response to | Re: pg_get_publication_tables() output duplicate relid (Amit Langote <amitlangote09@gmail.com>) |
Responses |
Re: pg_get_publication_tables() output duplicate relid
|
List | pgsql-hackers |
On Tue, Dec 7, 2021 at 10:52 AM Amit Langote <amitlangote09@gmail.com> wrote: > > On Tue, Dec 7, 2021 at 1:01 PM Amit Kapila <amit.kapila16@gmail.com> wrote: > > On Mon, Dec 6, 2021 at 8:59 PM Amit Langote <amitlangote09@gmail.com> wrote: > > > On Mon, Dec 6, 2021 at 6:05 PM Amit Kapila <amit.kapila16@gmail.com> wrote: > > > > Your concern is not very clear to me. Can you be more specific in what > > > > kind of problem you see with such a design for row filtering? > > > > > > I guess my characterization of it is still vague but the problem I see > > > is that we'll be adding one more feature that allows manipulating > > > partitions directly, which means more system catalogs than there > > > already are that know about partitions as objects. I remember being > > > deliberate about avoiding pg_publication_rel entries for all > > > partitions when a partitioned table is added to a publication for that > > > very reason. > > > > The same will be true even after this new feature. > > Oh, interesting. > > > > Is covering the use case of defining different filters for each > > > partition important for developing that feature? > > > > > > > Users can only define the filters for a relation only when they want > > to add a particular partition to the publication. Say, if only root > > table is added to the publication (and pubviaroot is true) then we > > don't need row filters to be defined for partitions. Basically, there > > will be only one additional column in pg_publication_rel for the row > > filter. > > Okay, so you are talking about allowing setting filters on a partition > that is added *explicitly* to a publication. I guess that's the only > way to do such a thing given the syntax of FOR TABLE / ADD TABLE. > Filters specified on a partitioned table that is added to a > publication apply equally to all partitions, depending on the > publish_via_partition_root configuration. > Yes. > So if a partition is > explicitly present in a publication with a filter defined on it, I > suppose following are the possible scenarios: > > * publish_via_partition_root=true > > 1. If the root table is not present in the publication (perhaps > unlikely), use the partition's filter because there's nothing else to > consider. > > 2. If the root table is present in the publication (very likely), use > the root's filter, ignoring/overriding the partition's own if any. > > * publish_via_partition_root=false > > 1. If the root table is not present in the publication, use the > partition's filter because there's nothing else to consider. > > 2. If the root table is present in the publication, use the > partition's own filter if present, else root's. > I have not tested/checked each of these scenarios individually but I think it is something like, if publish_via_partition_root is false then we will always try to use partitions row filter and if it is not there then we don't use any filter. Similarly, if publish_via_partition_root is true, then we always try to use a partitioned table row filter and if it is not there (either because the partitioned table is not part of the publication or because there is no filter defined for it) then we don't use any filter. -- With Regards, Amit Kapila.
pgsql-hackers by date: