pgsql: libpq: PQhost to return active connected host or hostaddr

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: libpq: PQhost to return active connected host or hostaddr
Date: 2018-03-27 16:34:08
Message-ID: E1f0rY0-0004Yv-MX@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

libpq: PQhost to return active connected host or hostaddr

Previously, PQhost didn't return the connected host details when the
connection type was CHT_HOST_ADDRESS (i.e., via hostaddr). Instead, it
returned the complete host connection parameter (which could contain
multiple hosts) or the default host details, which was confusing and
arguably incorrect.

Change this to return the actually connected host or hostaddr
irrespective of the connection type. When hostaddr but no host was
specified, hostaddr is now returned. Never return the original host
connection parameter, and document that PQhost cannot be relied on
before the connection is established.

PQport is similarly changed to always return the active connection port
and never the original connection parameter.

Author: Hari Babu <kommi(dot)haribabu(at)gmail(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Reviewed-by: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Reviewed-by: David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1944cdc98273dbb8439ad9b387ca2858531afcf0

Modified Files
--------------
doc/src/sgml/libpq.sgml | 48 +++++++++++++++++++++++++++++++++++++--
src/interfaces/libpq/fe-connect.c | 25 ++++++++++----------
2 files changed, 59 insertions(+), 14 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Simon Riggs 2018-03-27 19:01:33 pgsql: Allow HOT updates for some expression indexes
Previous Message Teodor Sigaev 2018-03-27 14:43:02 Re: pgsql: Skip temp tables from basebackup.