Re: Added schema level support for publication.

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Greg Nancarrow <gregn4422(at)gmail(dot)com>
Cc: vignesh C <vignesh21(at)gmail(dot)com>, "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Smith <smithpb2250(at)gmail(dot)com>, Ajin Cherian <itsajin(at)gmail(dot)com>, Rahila Syed <rahilasyed90(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Subject: Re: Added schema level support for publication.
Date: 2021-10-18 03:52:06
Message-ID: CAA4eK1LPqLQ-tnrupw1BisJa9792rBFwZ1X+XOxbTL=LeGsuUw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 15, 2021 at 6:45 AM Greg Nancarrow <gregn4422(at)gmail(dot)com> wrote:
>
> On Thu, Oct 14, 2021 at 9:59 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > > If partitions belong to a different schema than the parent partitioned
> > > table, then the current patch implementation allows the partitions to
> > > (optionally) be explicitly added to a publication that includes the
> > > parent partitioned table (and for the most part, it doesn't seem to
> > > make any difference to the publication behavior). Should this be
> > > allowed?
> > >
> > > e.g.
> > >
> > > CREATE SCHEMA sch;
> > > CREATE SCHEMA sch1;
> > > CREATE TABLE sch.sale (sale_date date not null, country_code text,
> > > product_sku text, units integer) PARTITION BY RANGE (sale_date);
> > > CREATE TABLE sch1.sale_201901 PARTITION OF sch.sale FOR VALUES FROM
> > > ('2019-01-01') TO ('2019-02-01');
> > > CREATE TABLE sch1.sale_201902 PARTITION OF sch.sale FOR VALUES FROM
> > > ('2019-02-01') TO ('2019-03-01');
> > >
> > > postgres=# CREATE PUBLICATION pub FOR ALL TABLES IN SCHEMA sch, TABLE
> > > sch1.sale_201901, TABLE sch1.sale_201902;
> > > CREATE PUBLICATION
> > > postgres=# \dRp+
> > > Publication pub
> > > Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root
> > > -------+------------+---------+---------+---------+-----------+----------
> > > gregn | f | t | t | t | t | f
> > > Tables:
> > > "sch1.sale_201901"
> > > "sch1.sale_201902"
> > > Tables from schemas:
> > > "sch"
> > >
> >
> > I don't see any problem with this. Do you have a specific problem in
> > mind due to this?
> >
>
> I'm not sure if it's a problem as such, really just a query from me as
> to whether it should be allowed to also (redundantly) add partitions
> to the publication, in addition to the partitioned table, since the
> current documentation says: "When a partitioned table is added to a
> publication, all of its existing and future partitions are implicitly
> considered to be part of the publication".
> I guess it should be allowed, as I find I can do it in the current
> implementation just with TABLE.
>

I have also checked the "For Table" case and it behaves similar to
what the patch has for schema. So, I think it is better to retain the
current behavior of patch.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2021-10-18 03:59:28 Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber
Previous Message Tom Lane 2021-10-18 03:41:35 Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber