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

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Ajin Cherian <itsajin(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug in ALTER SUBSCRIPTION ... SERVER / ... CONNECTION with broken old server
Date: 2026-05-15 23:18:43
Message-ID: 65166eb6feb87356f8d60bfe646289ce15a6c729.camel@j-davis.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 2026-05-15 at 15:18 +0800, Chao Li wrote:
> 0002 adds this Assert:
> ```
> if (update_failover || update_two_phase || check_pub_rdt)
> {
> bool must_use_password;
> char    *err;
> WalReceiverConn *wrconn;
>
> Assert(conninfo_needed);
> ```
>
> So, for those two paths, if check_pub_rdt is true, then the Assert
> will be fired, is that intentional?

I've fixed it to be Assert(new_conninfo || orig_conninfo_needed).

Also, the code above was missing the case of SUBOPT_ORIGIN which could
set check_pub_rdt. I changed it to be more conservative and set
orig_conninfo_needed=false when one of:

ALTER SUBSCRIPTION ... SERVER
ALTER SUBSCRIPTION ... CONNECTION
ALTER SUBSCRIPTION ... SET (slot_name=NONE)

and not try to be precise about which other settings might need
check_pub_rdt or not.

What do you think of v6-0003? Is it over-engineered? Should the
subtransaction happen at a lower level? Is there an alternative to
using a subtransaction?

Regards,
Jeff Davis

Attachment Content-Type Size
v6-0001-Avoid-errors-during-ALTER-SUBSCRIPTION.patch text/x-patch 18.2 KB
v6-0002-Avoid-errors-during-DROP-SUBSCRIPTION-when-slot_n.patch text/x-patch 7.2 KB
v6-0003-DROP-SUBSCRIPTION-improve-error-message.patch text/x-patch 4.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Álvaro Herrera 2026-05-15 22:09:18 Re: Move FOR PORTION OF checks out of analysis