Re: Added schema level support for publication.

From: vignesh C <vignesh21(at)gmail(dot)com>
To: Greg Nancarrow <gregn4422(at)gmail(dot)com>
Cc: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(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>, "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>
Subject: Re: Added schema level support for publication.
Date: 2021-07-26 05:21:38
Message-ID: CALDaNm27LRWF9ney=cVeD-0jc2+J5Y0wNQhighZB=Aat4VbNBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 26, 2021 at 8:17 AM Greg Nancarrow <gregn4422(at)gmail(dot)com> wrote:
>
> On Fri, Jul 23, 2021 at 10:16 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
> >
> > I have changed it to pg_pubication_schema as earlier as both you and Houzj San felt pg_publication_schema was better. This is fixed in the v14 patch attached at [1].
> > [1] - https://www.postgresql.org/message-id/CALDaNm3DTj535ezfmm8QHLOtOkcHF2ZcCfSjfR%3DVbTbLZXFRsA%40mail.gmail.com
> >
>
> Thanks, I think it looks better.
>
> On another issue, there seems to be problems with pg_dump support for
> FOR SCHEMA publications.
>
> For example:
>
> CREATE PUBLICATION p FOR SCHEMA myschema;
>
> pg_dump is dumping:
>
> CREATE PUBLICATION p WITH (publish = 'insert, update, delete, truncate');
> ...
> ALTER PUBLICATION p ADD SCHEMA p;
>
> Obviously that last line should instead be "ALTER PUBLICATION p ADD
> SCHEMA myschema;"
>
> I think the bug is caused by the following:
>
> + appendPQExpBuffer(query,
> + "ALTER PUBLICATION %s ADD SCHEMA %s;\n",
> + fmtId(pubsinfo->pubname), fmtId(schemainfo->dobj.name));
>
> The comment for fmtId() says:
>
> * Note that the returned string must be used before calling fmtId again,
> * since we re-use the same return buffer each time.
>
> So I think there was a reason why the ALTER PUBLICATION and ADD SCHEMA
> were previously formatted separately (and so should NOT have been
> combined).
> It should be restored to how it was in the previous patch version.

Thanks for the comment, this is modified in the v15 patch attached.

Regards,
Vignesh

Attachment Content-Type Size
v15-0001-Added-schema-level-support-for-publication.patch application/x-patch 96.5 KB
v15-0002-Tests-and-documentation-for-schema-level-support.patch application/x-patch 47.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2021-07-26 05:25:06 Re: Added schema level support for publication.
Previous Message Dilip Kumar 2021-07-26 05:15:17 Re: [BUG]Update Toast data failure in logical replication