Skip to content

Commit ff4fb4c

Browse files
committed
Fix error message when a hostaddr cannot be parsed.
We were incorrectly passing hostname, not hostaddr, in the error message, and because of that, you got: $ psql 'hostaddr=foo' psql: could not parse network address "(null)": Name or service not known Backpatch to v10, where this was broken (by commit 7b02ba6). Report and fix by Robert Haas. Discussion: https://www.postgresql.org/message-id/CA+TgmoapFQA30NomGKEaZCu3iN7mF7fux8fbbk9SouVOT2JP7w@mail.gmail.com
1 parent a1dc4ea commit ff4fb4c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/interfaces/libpq/fe-connect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1744,7 +1744,7 @@ connectDBStart(PGconn *conn)
17441744
if (ret || !ch->addrlist)
17451745
appendPQExpBuffer(&conn->errorMessage,
17461746
libpq_gettext("could not parse network address \"%s\": %s\n"),
1747-
ch->host, gai_strerror(ret));
1747+
ch->hostaddr, gai_strerror(ret));
17481748
break;
17491749

17501750
case CHT_UNIX_SOCKET:

0 commit comments

Comments
 (0)