Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wOqXW-000EVF-06 for pgsql-hackers@arkaria.postgresql.org; Mon, 18 May 2026 05:29:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wOqXT-001DKJ-3C for pgsql-hackers@arkaria.postgresql.org; Mon, 18 May 2026 05:29:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wOqXT-001DKB-2I for pgsql-hackers@lists.postgresql.org; Mon, 18 May 2026 05:29:16 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wOqXS-000000008Oa-1OV4 for pgsql-hackers@postgresql.org; Mon, 18 May 2026 05:29:16 +0000 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-367d88b9940so963579a91.1 for ; Sun, 17 May 2026 22:29:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779082152; x=1779686952; darn=postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=vk8GLj6uyBSWTGFd4WdfdczfDEP1/4eiwQy1a5jBfXg=; b=LsfQRyuTfTEDup8kSckYfkdvmD8nRYz0/2EZL5wnGrmT8h1s1FFf8YRExTBJJeT+oN Roinet22IiogGKvpqck/ELPlhIIvFGUsD4uWc4umraiWiRKwy3Zzz7LInbtsmOivBAok 0ZLSXJUzLgwCkb4cY5Ox4XDaLNxbEcOstpwJf7K+pKKWG50xYLdFRbozl5ylri3aav3F A60OcSkhBW+ZvuHtE+N5B1jw+x24YHqYfD2xHST6KkJxeqADt8JGhSKKgwRmMGxr/5jR b6l2HmM7pyeCrREPj472yZ7s91UqMEAaJVDAqooTf7WvhCZeIsU2q1+K65im+sM6Z6FX C3sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779082152; x=1779686952; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=vk8GLj6uyBSWTGFd4WdfdczfDEP1/4eiwQy1a5jBfXg=; b=o1SOTJ+Jllkz8rbxZ0Nrl3/XwT4vLx0vmU6bxQsDt8Vh9AyFJayW4wYu7l5FfOBhWx xL6d9gLbnssKPI3g8dgpI2E6tbLfRozXmXaZYEf5IqswP3otAJZmVTy9Rsk6wz+Rw56Y 5oG+NPo0928FppdCdao8Ccq1XwfUNL98/vFFPsJ5Grm5dRXDTPRzgAW1ylsBhyTLlrP9 ug7OnD+IuVWSH127z/1HwmOU8tGDw2FLpOXCRcrGn7STCxh0jYew6n8TcAM9bYi137Kr /+D6m88XWUsPfJUogEEObcrhcEW1IGbs3pfyqXWGqukc0GqE1eOojL4k4IRyU522eZ78 vjQA== X-Forwarded-Encrypted: i=1; AFNElJ8j6I9Zo7hKAj0UPE7Zso+a5w8kVWaa5ZBTwDD26Gwd9FUy3mBV0ok5bxCE26dhEIHdF1XrEtZA0Yr1pL/w@postgresql.org X-Gm-Message-State: AOJu0YxyKKcBjZlSnUs6yElQqfOIyUsX5sWV6MeaMx84WnLJBrkTqO50 VfSaHYyedvjCGJK2RphaHksIVrdUkU2dQ283OSSo3jdNHzZ+UkTVynPh X-Gm-Gg: Acq92OH552y1NfddUJUpd3nGmJmoOzWzWObKqQdqGpQ6ltgvQ5gePrj3Znt4ndFjkgg ATCqFpXN96xJzpNtEG/TRoJO4uzWv97fs3r3NiwP+rUzFO886yA1disK7eGM0dx9sqY4r75O+QI 0EZbujHa6MTZo6DuMFj2GHmciAFSb7M0ZUq1rscs9vDtLfLTsuYwQ1NyR6T3rxUel9RMRQ4ozHa nue/QLAyBWzoWfzn1LZKTTMHdm0iVG592/b0E0Mcbqujgm5bIhG0udQwDng2xtFZxwk8+5NUsSd aNBsJL34+YwLfgGtMTVbWs+RsYvT+e6FvZRXR4Y+kILRRWPwsqujD4yBDBCLv5uLd/ehcdEpPyy So5+jOb8wPt8B3MqDkcm3Mb8s6/PG61rsrjJAZ+OVL0gQ/v9DRUVpzGaEkZbw7M3i7R2gQu+VPd RXmkUUXRffRn/ib9j6UA3XBhtKmkfEIs5m37RcweL4oNIehuvruP7Q X-Received: by 2002:a17:90b:33cd:b0:368:7536:b5b7 with SMTP id 98e67ed59e1d1-36951b71e46mr13780533a91.16.1779082152292; Sun, 17 May 2026 22:29:12 -0700 (PDT) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3695157c3cfsm9769347a91.5.2026.05.17.22.29.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 May 2026 22:29:11 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.21\)) Subject: Re: Bug in ALTER SUBSCRIPTION ... SERVER / ... CONNECTION with broken old server From: Chao Li In-Reply-To: <65166eb6feb87356f8d60bfe646289ce15a6c729.camel@j-davis.com> Date: Mon, 18 May 2026 13:28:32 +0800 Cc: Zsolt Parragi , "Hayato Kuroda (Fujitsu)" , Ajin Cherian , PostgreSQL-development Content-Transfer-Encoding: quoted-printable Message-Id: <24C6472D-DCAB-4F69-AE8A-FFB4AAB3F6F0@gmail.com> References: <960DD2C4-A22C-463A-90ED-86E0FABD8D20@gmail.com> <8B38AFCA-7FFA-44CF-B9A8-81BDCEAFB224@gmail.com> <705148C3-519C-45E7-9EA8-48D9F3B79B06@gmail.com> <1B3A7FF0-3292-484F-992C-27D172772EB8@gmail.com> <65166eb6feb87356f8d60bfe646289ce15a6c729.camel@j-davis.com> To: Jeff Davis X-Mailer: Apple Mail (2.3864.400.21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On May 16, 2026, at 07:18, Jeff Davis wrote: >=20 > 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; >>=20 >> Assert(conninfo_needed); >> ``` >>=20 >> So, for those two paths, if check_pub_rdt is true, then the Assert >> will be fired, is that intentional? >=20 > I've fixed it to be Assert(new_conninfo || orig_conninfo_needed). >=20 > 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=3Dfalse when one of: >=20 > ALTER SUBSCRIPTION ... SERVER > ALTER SUBSCRIPTION ... CONNECTION > ALTER SUBSCRIPTION ... SET (slot_name=3DNONE) >=20 > and not try to be precise about which other settings might need > check_pub_rdt or not. Yep, this part looks good now. >=20 > 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? >=20 For the reason you described in the commit message, catching the error = and later reporting it through ReportSlotConnectionError(), I don't = think this is over-engineered. I also think keeping the subtransaction = inside construct_subserver_conninfo() is reasonable, because this = error-capturing behavior seems specific to the DROP SUBSCRIPTION path. As for whether the HINT itself really helps, I would reserve my opinion. = As the test output shows: ``` DROP SUBSCRIPTION regress_testsub6; ERROR: could not connect to publisher when attempting to drop = replication slot "dummy": user mapping not found for user = "regress_subscription_user3", server "test_server" HINT: Use ALTER SUBSCRIPTION ... DISABLE to disable the subscription, = and then use ALTER SUBSCRIPTION ... SET (slot_name =3D NONE) to = disassociate it from the slot. ``` The error message already says that the problem is =E2=80=9Cuser mapping = not found=E2=80=9D, so fixing the user mapping could also be a solution. = So, the HINT is still useful, but it might not be the most direct fix in = some case. I got another small comment. Now construct_subserver_conninfo() has some = duplicate code block of getting foreign server, aclcheck and = ForeignServerConnectionString as what GetSubscription() has, maybe we = can wrap that piece of code into a helper function. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/