Skip to content
Snippets Groups Projects
Commit 62038810 authored by Tom Lane's avatar Tom Lane
Browse files

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.

Back-patch of commit 1944cdc9
into the v10 branch.

Author: Hari Babu <kommi.haribabu@gmail.com>
Reviewed-by: default avatarMichael Paquier <michael@paquier.xyz>
Reviewed-by: default avatarKyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Reviewed-by: default avatarDavid G. Johnston <david.g.johnston@gmail.com>
parent b805b63a
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment