mirror of
https://github.com/postgres/postgres.git
synced 2025-10-29 22:49:41 +03:00
psql: Show IP address in \conninfo
When hostaddr is given, the actual IP address that psql is connected to can be totally unexpected for the given host. The more verbose output we now generate makes things clearer. Since the "host" and "hostaddr" parts of the conninfo could come from different sources (say, one of them is in the service specification or a URI-style conninfo and the other is not), this is not as silly as it may first appear. This is also definitely useful if the hostname resolves to multiple addresses. Author: Fabien Coelho Reviewed-by: Pavel Stehule, Arthur Zakirov Discussion: https://postgr.es/m/alpine.DEB.2.21.1810261532380.27686@lancre https://postgr.es/m/alpine.DEB.2.21.1808201323020.13832@lancre
This commit is contained in:
@@ -397,6 +397,7 @@ struct pg_conn
|
||||
int nconnhost; /* # of hosts named in conn string */
|
||||
int whichhost; /* host we're currently trying/connected to */
|
||||
pg_conn_host *connhost; /* details about each named host */
|
||||
char *connip; /* IP address for current network connection */
|
||||
|
||||
/* Connection data */
|
||||
pgsocket sock; /* FD for socket, PGINVALID_SOCKET if
|
||||
|
||||
Reference in New Issue
Block a user