Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lehhz-0004SD-Aw for pgsql-hackers@arkaria.postgresql.org; Thu, 06 May 2021 17:22:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lehhx-0001bN-Qw for pgsql-hackers@arkaria.postgresql.org; Thu, 06 May 2021 17:22:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lehhx-0001bF-JC for pgsql-hackers@lists.postgresql.org; Thu, 06 May 2021 17:22:41 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lehhs-0005aZ-69 for pgsql-hackers@postgresql.org; Thu, 06 May 2021 17:22:40 +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 146HMRjO4170265; Thu, 6 May 2021 13:22:27 -0400 From: Tom Lane To: Justin Pryzby cc: Hubert Zhang , tsunakawa.takay@fujitsu.com, pgsql-hackers@postgresql.org, Andreas Seltenreich , Bruce Momjian Subject: Re: Multiple hosts in connection string failed to failover in non-hot standby mode In-reply-to: <20210506162651.GJ27406@telsasoft.com> References: <229507.1610056206@sss.pgh.pa.us> <770711.1610318330@sss.pgh.pa.us> <20210506162651.GJ27406@telsasoft.com> Comments: In-reply-to Justin Pryzby message dated "Thu, 06 May 2021 11:26:51 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4170263.1620321747.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 06 May 2021 13:22:27 -0400 Message-ID: <4170264.1620321747@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Justin Pryzby writes: > 52a10224 broke sqlsmith, of all things. > It was using errmsg as a test of success, instead of checking if the con= nection > result wasn't null: > conn =3D PQconnectdb(conninfo.c_str()); > char *errmsg =3D PQerrorMessage(conn); > if (strlen(errmsg)) > throw dut::broken(errmsg, "08001"); > That's clearly the wrong thing to do, but maybe this should be described= in the > release notes as a compatibility issue, in case other people had the sam= e idea. > Clearing errorMessage during success is an option.. Hm. I'd debated whether to clear conn->errorMessage at the end of a successful connection sequence, and decided not to on the grounds that it might be interesting info (eg it could tell you why you ended up connected to server Y and not server X). But perhaps it's too much of a compatibility break for this small benefit. I'm curious though why it took this long for anyone to complain. I'd supposed that people were running sqlsmith against HEAD on a pretty regular basis. regards, tom lane