Re: fix psql \conninfo & \connect when using hostaddr

Alvaro Herrera <alvherre@2ndquadrant.com>

From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Noah Misch <noah@leadboat.com>, Dmitry Dolgov <9erthalion6@gmail.com>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>, Arthur Zakirov <a.zakirov@postgrespro.ru>, Robert Haas <robertmhaas@gmail.com>
Date: 2019-06-14T22:31:52Z
Lists: pgsql-hackers
On 2019-Jun-13, Fabien COELHO wrote:

> Thanks for the pointer! I did not notice this one. At least the API looks
> better than the one I was suggesting:-)
> 
> ISTM that this function could be used to set other parameters, fixing some
> other issues such as ignoring special parameters on reconnections.
> 
> Anyway, attached an attempt at implementing the desired behavior wrt
> hostaddr.

BTW I tested this manually and it seemed to work as intended, ie., if I
change /etc/hosts for the hostname I am using between one connection and
the next, we do keep the hostaddr if it was specified, or we resolve the
name again if it's not.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



Commits

  1. Tweak libpq's PQhost, PQhostaddr, and psql's \connect

  2. psql: Show IP address in \conninfo