pgsql: Give a better error message on invalid hostaddr option.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Give a better error message on invalid hostaddr option.
Date: 2017-06-09 10:06:57
Message-ID: E1dJGoj-0002z0-7U@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

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

Discussion: https://www.postgresql.org/message-id/10badbc6-4d5a-a769-623a-f7ada43e14dd@iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/76b11e8a43eca4612dfccfe7f3ebd293fb8a46ec

Modified Files
--------------
src/interfaces/libpq/fe-connect.c | 41 +++++++++++++++++++++++++--------------
1 file changed, 26 insertions(+), 15 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2017-06-09 13:27:34 pgsql: Improve tablesync behavior with concurrent changes
Previous Message Heikki Linnakangas 2017-06-09 09:05:50 pgsql: Fix script name in README.

Browse pgsql-hackers by date

  From Date Subject
Next Message Mithun Cy 2017-06-09 10:22:20 Re: List of hostaddrs not supported
Previous Message Heikki Linnakangas 2017-06-09 09:52:02 Re: List of hostaddrs not supported