Re: Bug in ALTER SUBSCRIPTION ... SERVER / ... CONNECTION with broken old server

From: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
To: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
Cc: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, Ajin Cherian <itsajin(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: Re: Bug in ALTER SUBSCRIPTION ... SERVER / ... CONNECTION with broken old server
Date: 2026-07-30 11:06:42
Message-ID: CANhcyEXoFVObwpVPRRzw6k5-nEK3mvAM7Yk0tZTt9Yfq428MHg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 30 Jul 2026 at 07:52, Hayato Kuroda (Fujitsu)
<kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
>
> Dear Shlok,
>
> > Thanks for reviewing the patch. I have updated the patch and attached
> > the v2 patch.
>
> Thanks for the update. According to others, different kinds of statements should be
> different else-if statements. So we may have to be something like below:
>
> ```
> else if (stmt->kind == ALTER_SUBSCRIPTION_REFRESH_PUBLICATION)
> {
> ...
> }
> else if (stmt->kind == ALTER_SUBSCRIPTION_ADD_PUBLICATION ||
> stmt->kind == ALTER_SUBSCRIPTION_DROP_PUBLICATION ||
> stmt->kind == ALTER_SUBSCRIPTION_SET_PUBLICATION)
> {
> if (IsSet(opts.specified_opts, SUBOPT_REFRESH) && opts.refresh)
> ...
> }
> ```
>
I have modified the code as per your suggestions.

But, for ALTER SUBSCRIPTION ... ADD/DROP/SET PUBLICATION by default
'refresh' option is true. So even if the refresh option is not
specified explicitly, we should validate the server.
So instead of "if (IsSet(opts.specified_opts, SUBOPT_REFRESH) &&
opts.refresh)", I have used "if(opts.refresh)".
Please let me know if I am missing something.

Attached the updated patch.

Thanks,
Shlok Kyal

Attachment Content-Type Size
v3-0001-Check-foreign-server-permissions-for-ALTER-SUBSCR.patch application/octet-stream 5.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2026-07-30 11:12:57 Re: COPY TO BLACKHOLE / pg_dump -j -Fb
Previous Message Hannu Krosing 2026-07-30 11:06:39 Re: Direct Toast PoC