Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

From: japin <japinli(at)hotmail(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax
Date: 2021-01-28 04:37:03
Message-ID: MEYP282MB16692BF49987DE805C53E15CB6BA9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Thu, 28 Jan 2021 at 12:22, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> On Wed, Jan 27, 2021 at 7:35 PM Li Japin <japinli(at)hotmail(dot)com> wrote:
>> > I don't see any problem if ALTER SUBSCRIPTION ... ADD PUBLICATION with
>> > refresh true refreshes only the newly added publications, because what
>> > we do in AlterSubscription_refresh() is that we fetch the tables
>> > associated with the publications from the publisher, compare them with
>> > the previously fetched tables from that publication and add the new
>> > tables or remove the table that don't exist in that publication
>> > anymore.
>> >
>> > For ALTER SUBSCRIPTION ... DROP PUBLICATION, also we can do the same
>> > thing i.e. refreshes only the dropped publications.
>> >
>> > Thoughts?
>>
>> Agreed. We just only need to refresh the added/dropped publications. Furthermore, for publications that will be dropped, we do not need the “copy_data” option, right?
>
> I think you are right. The copy_data option doesn't make sense for
> ALTER SUBSCRIPTION ... DROP PUBLICATION, maybe we should throw an
> error if the user specifies it. Of course, we need that option for
> ALTER SUBSCRIPTION ... ADD PUBLICATION.
>

Thanks for your confirm. Attached v3 patch fix it.

* v3-0001
Only refresh the publications that will be added/dropped, also remove "copy_data"
option from DROP PUBLICATION.

* v3-0002
Add a new testcase for DROP PUBLICATION WITH (copy_data).

* v3-0003
Remove the reference of REFRESH PUBLICATION in DROP PUBLICATION.

* v3-0004
Do not change.

Attaching v3 patches, please consider these for further review.

--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.

Attachment Content-Type Size
v3-0001-Introduce-a-new-syntax-to-add-drop-publications.patch text/x-patch 6.4 KB
v3-0002-Test-ALTER-SUBSCRIPTION-.-ADD-DROP-PUBLICATION.patch text/x-patch 4.3 KB
v3-0003-Add-documentation-for-ALTER-SUBSCRIPTION.ADD-DROP.patch text/x-patch 4.5 KB
v3-0004-Add-tab-complete-for-ALTER-SUBSCRIPTION.ADD-DROP.patch text/x-patch 1.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-01-28 04:54:24 Re: On login trigger: take three
Previous Message Dilip Kumar 2021-01-28 04:25:42 Re: Is Recovery actually paused?