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

From: japin <japinli(at)hotmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: "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-27 09:56:36
Message-ID: MEYP282MB16692E1C4E2ECFA6DDBFF73FB6BB0@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Wed, 27 Jan 2021 at 16:59, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> On Tue, Jan 26, 2021 at 9:18 AM japin <japinli(at)hotmail(dot)com> wrote:
>>
>>
>> When I read the discussion in [1], I found that update subscription's publications
>> is complicated.
>>
>> For example, I have 5 publications in subscription.
>>
>> CREATE SUBSCRIPTION mysub1 CONNECTION 'host=localhost port=5432 dbname=postgres'
>> PUBLICATION mypub1, mypub2, mypub3, mypub4, mypub5;
>>
>> If I want to drop "mypub4", we should use the following command:
>>
>> ALTER SUBSCRIPTION mysub1 SET PUBLICATION mypub1, mypub2, mypub3, mypub5;
>>
>> Also, if I want to add "mypub7" and "mypub8", it will use:
>>
>> ALTER SUBSCRIPTION mysub1 SET PUBLICATION mypub1, mypub2, mypub3, mypub5, mypub7, mypub8;
>>
>> Attached implement ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax, for the above
>> two cases, we can use the following:
>>
>> ALTER SUBSCRIPTION mysub1 DROP PUBLICATION mypub4;
>>
>> ALTER SUBSCRIPTION mysub1 DROP PUBLICATION mypub7, mypub8;
>>
>> I think it's more convenient. Any thoughts?
>>
>
> While the new proposed syntax does seem to provide some ease for users
> but it has nothing which we can't do with current syntax. Also, in the
> current syntax, there is an additional provision for refreshing the
> existing publications as well. So, if the user has to change the
> existing subscription such that it has to (a) add new publication(s),
> (b) remove some publication(s), (c) refresh existing publication(s)
> then all can be done in one command whereas with your new proposed
> syntax user has to write three separate commands.
>

If we want add and drop some publications, we can use SET PUBLICATION, it
is more convenient than ADD and DROP PUBLICATION, however if we just want to
add (or drop) publication into (or from) subcription which has much publications,
then the new syntax is more convenient IMO.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Rofail 2021-01-27 09:58:01 Re: [HACKERS] GSoC 2017: Foreign Key Arrays
Previous Message japin 2021-01-27 09:51:30 Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax