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 1l2HaC-0000W6-Iw for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jan 2021 17:47:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l2HaB-0007qF-Go for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jan 2021 17:47:51 +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 1l2HaB-0007q3-9q for pgsql-hackers@lists.postgresql.org; Wed, 20 Jan 2021 17:47:51 +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 1l2Ha9-0007Ly-0G for pgsql-hackers@postgresql.org; Wed, 20 Jan 2021 17:47:50 +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 10KHllut718536; Wed, 20 Jan 2021 12:47:47 -0500 From: Tom Lane To: Robert Haas cc: "pgsql-hackers@postgresql.org" Subject: Re: strange error reporting In-reply-to: References: <717401.1611163169@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Wed, 20 Jan 2021 12:34:30 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <718534.1611164867.1@sss.pgh.pa.us> Date: Wed, 20 Jan 2021 12:47:47 -0500 Message-ID: <718535.1611164867@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > On Wed, Jan 20, 2021 at 12:19 PM Tom Lane wrote: >> But the 'could not connect to socket' part is a consequence of my >> recent fiddling with libpq's connection failure reporting, see >> 52a10224e. We could discuss exactly how that ought to be spelled, >> but the idea is to consistently identify the host that we were trying >> to connect to. If you have a multi-host connection string, it's >> conceivable that "rhaas" exists on some of those hosts and not others, >> so I do not think the info is irrelevant. > I'm not saying that which socket I used is totally irrelevant although > in most cases it's going to be a lot of detail. I'm just saying that, > at least for me, when you say you can't connect to a socket, I at > least think about the return value of connect(2), which was clearly 0 > here. Fair. One possibility, which'd take a few more cycles in libpq but likely not anything significant, is to replace "could not connect to ..." with "while connecting to ..." once we're past the connect() per se. > Maybe it would be better if it said: > connection to database at socket "/tmp/.s.PGSQL.5432" failed: FATAL: > database "rhaas" does not exist I'd be inclined to spell it "connection to server at ... failed", but that sort of wording is surely also possible. regards, tom lane