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 1vuhrE-002Owh-1b for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Feb 2026 02:09:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vuhrD-00GSGr-1S for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Feb 2026 02:09:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vuhrD-00GSGj-0a for pgsql-hackers@lists.postgresql.org; Tue, 24 Feb 2026 02:09:03 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vuhrA-00000000t8P-0uGu for pgsql-hackers@lists.postgresql.org; Tue, 24 Feb 2026 02:09:02 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 61O28uYf3864575; Mon, 23 Feb 2026 21:08:56 -0500 From: Tom Lane To: Jacob Champion cc: Jelte Fennema-Nio , pgsql-hackers@lists.postgresql.org, Andrew Dunstan Subject: Re: pgsql: libpq: Grease the protocol by default In-reply-to: References: <3626145.1771885089@sss.pgh.pa.us> <3635497.1771889682@sss.pgh.pa.us> <3797860.1771893905@sss.pgh.pa.us> Comments: In-reply-to Jacob Champion message dated "Mon, 23 Feb 2026 17:05:45 -0800" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <3864559.1771898929.0@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Mon, 23 Feb 2026 21:08:56 -0500 Message-ID: <3864574.1771898936@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="UTF-8" Content-ID: <3864559.1771898929.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Jacob Champion writes: > On Mon, Feb 23, 2026 at 4:45 PM Tom Lane wrote: >> Also: I was initially baffled why you thought this needs >> back-patching, but I guess you have one eye on packagers like >> Debian who think they can make older versions use newer libpq.so. > Right. Actually, that is going to be harder than you thought, because libpq before v18 will spit up on connection option "max_protocol_version". This patch will not work as-is for back-patching unless we care to also back-patch the addition of that option, which I'd be inclined to resist. Fortunately, we long ago had the foresight to invent PQlibVersion, so you could make addition of the extra option conditional on PQlibVersion(conn) >= 180000 in branches before 18. > Hmmm, looks like the -dump1.log output is actually from *before* > pg_upgrade actually runs: Yeah, I came to the same conclusion. I got a clean BF run using your patch together with the attached patch for the BF client. (In this patch, I did not worry about scenarios involving old minor releases. If Andrew is excited about that case he can extend the version-comparison logic.) regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="cross-version.patch"; charset="us-ascii" Content-ID: <3864559.1771898929.2@sss.pgh.pa.us> Content-Description: cross-version.patch Content-Transfer-Encoding: quoted-printable --- PGBuild/Modules/TestUpgradeXversion.pm~ 2025-11-25 07:47:25.000000000 = -0500 +++ PGBuild/Modules/TestUpgradeXversion.pm 2026-02-23 20:57:31.640149574 -= 0500 @@ -483,9 +483,17 @@ sub test_upgrade ## no critic (Subrou $dump_opts .=3D ' --extra-float-digits=3D0'; } = + # with very old servers we must restrict the protocol version. + my $maxpversion =3D ""; + if ( ($this_branch eq 'HEAD' || $this_branch gt 'REL_18_STABLE') + && ($oversion ne 'HEAD' && $oversion le 'REL_9_2_STABLE')) + { + $maxpversion =3D '-d max_protocol_version=3D3.0'; + } + # use the NEW pg_dumpall so we're comparing apples with apples. setinstenv($self, "$installdir", $save_env); - system( qq{"$installdir/bin/pg_dumpall" $dump_opts -p $sport -f } + system( qq{"$installdir/bin/pg_dumpall" $dump_opts $maxpversion -p $spor= t -f } . qq{"$upgrade_loc/origin-$oversion.sql" } . qq{> "$upgrade_loc/$oversion-dump1.log" 2>&1}); return if $?; ------- =_aaaaaaaaaa0--