summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2018-11-19 14:34:12 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2018-11-19 14:34:12 -0300
commit6e5f8d489acccdc50a35a1b7db8e72b5ad579253 (patch)
treeef5cf5e4758c70c8076b665dc2d79305ad55e598 /doc/src
parent7ee5f88e650619ee619f7e2854ac50ff59d0b0c7 (diff)
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
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/libpq.sgml30
1 files changed, 30 insertions, 0 deletions
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index 601091c5709..d2e5b08541e 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -1735,6 +1735,36 @@ char *PQhost(const PGconn *conn);
</listitem>
</varlistentry>
+
+ <varlistentry id="libpq-pqhostaddr">
+ <term>
+ <function>PQhostaddr</function>
+ <indexterm>
+ <primary>PQhostaddr</primary>
+ </indexterm>
+ </term>
+
+ <listitem>
+ <para>
+ Returns the server IP address of the active connection.
+ This can be the address that a host name resolved to,
+ or an IP address provided through the <literal>hostaddr</literal>
+ parameter.
+<synopsis>
+char *PQhostaddr(const PGconn *conn);
+</synopsis>
+ </para>
+
+ <para>
+ <function>PQhostaddr</function> returns <symbol>NULL</symbol> if the
+ <parameter>conn</parameter> argument is <symbol>NULL</symbol>.
+ Otherwise, if there is an error producing the host information
+ (perhaps if the connection has not been fully established or
+ there was an error), it returns an empty string.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry id="libpq-pqport">
<term>
<function>PQport</function>