Re: [COMMITTERS] pgsql: Give a better error message on invalidhostaddr option. - Mailing list pgsql-hackers

From Robert Haas
Subject Re: [COMMITTERS] pgsql: Give a better error message on invalidhostaddr option.
Date
Msg-id CA+TgmoapFQA30NomGKEaZCu3iN7mF7fux8fbbk9SouVOT2JP7w@mail.gmail.com
Whole thread Raw
Responses Re: [COMMITTERS] pgsql: Give a better error message on invalidhostaddr option.  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-hackers
On Fri, Jun 9, 2017 at 6:06 AM, Heikki Linnakangas
<heikki.linnakangas@iki.fi> wrote:
> Give a better error message on invalid hostaddr option.
>
> If you accidentally pass a host name in the hostaddr option, e.g.
> hostaddr=localhost, you get an error like:
>
> psql: could not translate host name "localhost" to address: Name or service not known
>
> That's a bit confusing, because it implies that we tried to look up
> "localhost" in DNS, but it failed. To make it more clear that we tried to
> parse "localhost" as a numeric network address, change the message to:
>
> psql: could not parse network address "localhost": Name or service not known

This commit doesn't seem to deliver the behavior described in the
commit message.  Instead, I get:

[rhaas pgsql]$ psql 'hostaddr=localhost'
psql: could not parse network address "(null)": nodename nor servname
provided, or not known

Proposed patch attached.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Possible performance regression in version 10.1 with pgbenchread-write tests.
Next
From: Jesper Pedersen
Date:
Subject: Re: partition tree inspection functions