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 1wNmpL-0013mC-2m for pgsql-hackers@arkaria.postgresql.org; Fri, 15 May 2026 07:19:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wNmpJ-00H0Tj-2L for pgsql-hackers@arkaria.postgresql.org; Fri, 15 May 2026 07:19:17 +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 1wNmpJ-00H0Ta-1E for pgsql-hackers@lists.postgresql.org; Fri, 15 May 2026 07:19:17 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wNmpG-00000000iIZ-3DzY for pgsql-hackers@postgresql.org; Fri, 15 May 2026 07:19:16 +0000 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-2ba17c8cfacso90232085ad.2 for ; Fri, 15 May 2026 00:19:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778829551; x=1779434351; 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=Jltw9SpF7MrQZfhdnTo8upCHXRpinP9a8pwXAVp/roI=; b=L+xlD1oNjAWgIi4wPlcRHRVbh52tiMc4JoAWpDSr3u1Mm84l5S335cImPyqaK+GDde aXHF/P5ouiTLBeLs+jzz3MtMFkQ0bEzOLKHQKaGrVjkMI71qE5WoErg49eAbNkWwaMOU iPaFkPnqjwhQZIoOIFCv58LNs7bG1dvp8z+04kNbEb0ZNx3s9COmHGKAypCld0weUOUm Q9aQetGeP22G+0Q9f0p4bVgAXlP03PAurQsBRZzm8voOD6oUbsCu79KVtMCHO69hHGsw rtl5asAIE+cW1fiLCaOPPX5i2NNJmaDoj1FfbSJto7uwMgwPri9nObVzF/vEU9w4J7Fg zlMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778829551; x=1779434351; 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=Jltw9SpF7MrQZfhdnTo8upCHXRpinP9a8pwXAVp/roI=; b=Q9cWewvw3LS2XPWd1KCAr94A87raNFytkD5fjiTYjOAOCRVRQ6ipWlWrGau6T95AmB zc0jUn/6LauLgtIDQwgh9I9Uj8MFG0A4uCiTgLQRcJNwW6IlNf8gvxSOuwtdXwZMB/pH iOB9vhU39iabnXlkYa4GUQB1XwEHVJgsmGEEjNHj6/rIPjyYwpkJsG/BBEYd/rZkgOwp DKkKjTWI9jHYGLuzmpUWZkT5LFNSlNlKzjg6eOopuvdcEBc9SLixa515jeh2Hyim6ddR V6Zj25KAYKytePAp2K3Atusk5ZI98kRKq1n65NV9Dg80nSri+sIRl/aAzneCUIr8WzCQ rQtw== X-Forwarded-Encrypted: i=1; AFNElJ8QgEUabxRHCiisHIxmLBC2XduBASEimo3Om4moQmXSUnDacGdivWwLzAztVKOxfOdVCmmHsRNP9FWcq1H3@postgresql.org X-Gm-Message-State: AOJu0YxNTIb6oZutIJiadNRoE6w6e/2oF4uBcSPYdrJA5acEM5kPG98G /sDrEjH2491JU5VCmiattcXA+ywRRH/ppueS50Atp0FfvffJQRz0MY65 X-Gm-Gg: Acq92OFppV/uDh2rviE9TgwfjojguGQ4Apc5jqizHeixqMOyZYkZjtsKqUgzWUcu2kg Q0ilCflwhYSFDtgAsZievegGMloPfWrK0VzGHfRoHNlJydLwOIkB30u+WqNCJ2SlKh3DOfHZNoF k5lGlc9wvXkJeOJ5F2kgxGXiMVG4q59KtMDzbHgzCDTlgOFb4Dkkf2XPjipsSmEhHEgJ/l95L2j 5joqNJiPdnJ/dJI3F95kzTbHyCwSLtHkmqgfI9HiwVnmWOBKOCnMdt02OZ5rDJnVNv0S+/QQwW3 HSxTl5HmuEwJXs+o6IfzckmMgMzeY563M2N661S9QBaYk0o8vRoQ8VGYIT3wkoieFSeY0/H+KUC pPD5uy5KZUYtqiCggtO4WAVG7DgRzkEcXj/7y0wzUKJgt8VQKuDxIKJa15JIsiEz/2ytlq4TGFa p4RGJgxsvHXBffNu3r8Xh6XCA0+U/5tLY= X-Received: by 2002:a17:902:db01:b0:2bd:2de3:51a4 with SMTP id d9443c01a7336-2bd7e8feac3mr32312275ad.27.1778829551349; Fri, 15 May 2026 00:19:11 -0700 (PDT) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2bd5d125159sm46981355ad.76.2026.05.15.00.19.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 May 2026 00:19:10 -0700 (PDT) Content-Type: text/plain; charset=us-ascii 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: Date: Fri, 15 May 2026 15:18:31 +0800 Cc: Zsolt Parragi , "Hayato Kuroda (Fujitsu)" , Ajin Cherian , PostgreSQL-development Content-Transfer-Encoding: quoted-printable Message-Id: <1B3A7FF0-3292-484F-992C-27D172772EB8@gmail.com> References: <960DD2C4-A22C-463A-90ED-86E0FABD8D20@gmail.com> <8B38AFCA-7FFA-44CF-B9A8-81BDCEAFB224@gmail.com> <705148C3-519C-45E7-9EA8-48D9F3B79B06@gmail.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 15, 2026, at 05:45, Jeff Davis wrote: >=20 > Hi, >=20 > I added a fix to the series: v5-0001 fixes check_pub_rdt for the > foreign server case. >=20 > On Sat, 2026-05-09 at 11:08 +0800, Chao Li wrote: >> Ah, I see. You added a new conninfo_needed parameter to >> GetSubscription(), which separates the decision of building conninfo >> from the ACL check. Cool, I believe this is a better approach. >>=20 >> So 0001 looks good to me. nitpick is that conninfo_aclcheck is now >> only meaningful when conninfo_needed is true. I wonder if we should >> mention that briefly in the function header comment, or add an >> assertion such as: Assert(conninfo_needed || !conninfo_aclcheck); to >> avoid possible misuse of conninfo_aclcheck in the future. >=20 > I refactored the fix in v5-0002 to do this in a more organized way: = now > all option parsing happens first, so I can more precisely decide which > paths need conninfo and which ones don't. >=20 >> So with 0002, if slotname is NULL but rstates is not NIL, it looks >> possible that we no longer build conninfo and therefore skip the >> cleanup on the publisher side. >=20 > I separated this into two patches: >=20 > v5-0003 just moves the connection string building after the early = exit, > so that if slotname is NONE and rstates is NIL, then it won't try to > build the connection string at all (and therefore won't get an error > while doing so). >=20 > v5-0004 fixes the remaining issue when slotname is NONE and rstates is > *not* NIL. It uses a subtransaction to catch the error, so that the > DROP TRANSACTION will still succeed even though it can't connect to = the > publisher to drop the tablesync slots. This feels a bit over- > engineered, but it does maintain the expected behavior in this case. = It > also routes errors inside of ForeignServerConnectionString() through > ReportSlotConnectionError(), which adds a helpful hint. >=20 > Regards, > Jeff Davis >=20 >=20 >=20 >=20 > = I have just one comment on v5: In 0002, for both ALTER_SUBSCRIPTION_SERVER and = ALTER_SUBSCRIPTION_CONNECTION, conninfo_needed is false: ``` if (stmt->kind =3D=3D ALTER_SUBSCRIPTION_SERVER || stmt->kind =3D=3D ALTER_SUBSCRIPTION_CONNECTION) { conninfo_needed =3D false; } ``` 0001 adds "check_pub_rdt =3D sub->retaindeadtuples;" to the both paths: 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? Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/