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-27 09:51:30
Message-ID: MEYP282MB166965FB821BD60BD7C2B9B1B6BB0@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Wed, 27 Jan 2021 at 17:46, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> On Wed, Jan 27, 2021 at 3:01 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>> > > 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.
>> >
>> > IIUC the initial patch proposed here, it does allow ALTER SUBSCRIPTION
>> > mysub1 ADD/DROP PUBLICATION mypub4 WITH (refresh = true);. Isn't this
>> > option enough to achieve what we can with ALTER SUBSCRIPTION mysub1
>> > SET PUBLICATION mypub1, mypub2 WITH (refresh = true);? Am I missing
>> > something here?
>> >
>>
>> I feel the SET syntax would allow refreshing existing publications as
>> well whereas, in Add, it will be only for new Publications.
>
> I think the patch v2-0001 will refresh all the publications, I mean
> existing and newly added publications. IIUC the patch, it first
> fetches all the available publications with the subscriptions and it
> sees if that list has the given publication [1], if not, then adds it
> to the existing publications list and returns that list [2]. If the
> refresh option is specified as true with ALTER SUBSCRIPTION ... ADD
> PUBLICATION, then it refreshes all the returned publications [3]. I
> believe this is also true with ALTER SUBSCRIPTION ... DROP
> PUBLICATION.
>
> So, I think the new syntax, ALTER SUBSCRIPTION .. ADD/DROP PUBLICATION
> will refresh the new and existing publications.
>

Yes! It will refresh the new and existing publications.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message japin 2021-01-27 09:56:36 Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax
Previous Message Bharath Rupireddy 2021-01-27 09:46:31 Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax