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

Fabien COELHO <coelho@cri.ensmp.fr>

From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>, Arthur Zakirov <a.zakirov@postgrespro.ru>, Robert Haas <robertmhaas@gmail.com>
Date: 2018-11-17T16:12:41Z
Lists: pgsql-hackers

Attachments

>> I'm working on improving the patch.
>
> Cool.

Here is the updated v2

  - libpq internal function getHostaddr get a length,
    and I added an assert about it.
  - added a few braces on if/if/else/if/else/else
  - added an UNKNOWN_HOST macro to hide "???"
  - moved host_addr[] declaration earlier to avoid some braces
  - I have not refactored psql connection message,
    but finally agree with Pavel & you have a point.

-- 
Fabien.

Commits

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

  2. psql: Show IP address in \conninfo