Re: strange error reporting
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2021-01-20T17:19:29Z
Lists: pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes: > I just made the mistake of trying to run pgbench without first running > createdb and got this: > pgbench: error: connection to database "" failed: could not connect to > socket "/tmp/.s.PGSQL.5432": FATAL: database "rhaas" does not exist > This looks pretty bogus because (1) I was not attempting to connect to > a database whose name is the empty string and (2) saying that it > couldn't connect to the socket is wrong, else it would not also be > showing a server message. I'm not sure about the empty DB name in the first part (presumably that's from pgbench, so what was your pgbench command exactly?). 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. Just looking at this, I wonder if we ought to drop pgbench's contribution to the message entirely; it seems like libpq's message is now fairly freestanding. regards, tom lane
Commits
-
pgbench: Remove dead code
- ef2a83323c3b 13.2 landed
- cfbbc1f17c24 9.5.25 landed
- be2729dfaac3 10.16 landed
- 6819b9042fe6 14.0 landed
- 4162f91d1c20 9.6.21 landed
- 30854d94c627 12.6 landed
- 3055e8d0f1e7 11.11 landed
-
Report the true database name on connection errors
- fdf9d005401d 12.6 landed
- fdd405c63fff 11.11 landed
- f2dc962360b3 9.5.25 landed
- f17e8f33f781 13.2 landed
- bcae842b962a 9.6.21 landed
- 11a708f8159f 10.16 landed
-
Avoid redundantly prefixing PQerrorMessage for a connection failure.
- 58cd8dca3de0 14.0 landed
-
Improve new wording of libpq's connection failure messages.
- 27a48e5a16ff 14.0 landed