Re: Added schema level support for publication.

From: vignesh C <vignesh21(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>, Greg Nancarrow <gregn4422(at)gmail(dot)com>, Ajin Cherian <itsajin(at)gmail(dot)com>, "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(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-08-25 13:03:53
Message-ID: CALDaNm1RpHMrHfo2m4SBxstFgo07x=kk63c+YrVwt1RAsEF2ZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 14, 2021 at 3:02 PM Peter Eisentraut <
peter(dot)eisentraut(at)enterprisedb(dot)com> wrote:
>
> On 13.08.21 04:59, Amit Kapila wrote:
> >> Even if we drop all tables added to the publication from it, 'pubkind'
> >> doesn't go back to 'empty'. Is that intentional behavior? If we do
> >> that, we can save the lookup of pg_publication_rel and
> >> pg_publication_schema in some cases, and we can switch the publication
> >> that was created as FOR SCHEMA to FOR TABLE and vice versa.
> >>
> > Do we really want to allow users to change a publication that is FOR
> > SCHEMA to FOR TABLE? I see that we don't allow to do that FOR TABLES.
> > postgres=# Alter Publication pub add table tbl1;
> > ERROR: publication "pub" is defined as FOR ALL TABLES
> > DETAIL: Tables cannot be added to or dropped from FOR ALL TABLES
publications.
>
> I think the strict separation between publication-for-tables vs.
> publication-for-schemas is a mistake. Why can't I have a publication
> that publishes tables t1, t2, t3, *and* schemas s1, s2, s3. Also note
> that we have a pending patch to add sequences support to logical
> replication. So eventually, a publication will be able to contain a
> bunch of different objects of different kinds.

Thanks for the feedback, now the same publication can handle schemas as
well as tables, and can be extended further to other objects. This is
handled in the v21 patch attached at [1]. It is supported by the following
syntax:
CREATE PUBLICATION pub FOR ALL TABLES IN SCHEMA s1,s2,s3, TABLE t1,t2,t3;

[1] -
https://www.postgresql.org/message-id/CALDaNm2iKJvSdCyh0S%2BwYgFjMNB4hu3kYjk%3DYrEkpqTJY9zW%2Bw%40mail.gmail.com

Regards,
Vignesh

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-08-25 13:13:49 Re: Failure of subscription tests with topminnow
Previous Message Nitin Jadhav 2021-08-25 12:42:09 Re: Multi-Column List Partitioning