Re: Enhance pg_stat_wal_receiver view to display connected host

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Haribabu Kommi <kommi.haribabu@gmail.com>
Cc: Fujii Masao <masao.fujii@gmail.com>, Michael Paquier <michael.paquier@gmail.com>, Pg Hackers <pgsql-hackers@postgresql.org>, Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: 2018-03-30T00:34:54Z
Lists: pgsql-hackers
On Fri, Mar 30, 2018 at 10:52:02AM +1100, Haribabu Kommi wrote:
> On Fri, Mar 30, 2018 at 7:26 AM, Fujii Masao <masao.fujii@gmail.com> wrote:
>> @@ -753,4 +753,6 @@ CREATE VIEW pg_stat_wal_receiver AS
>>              s.latest_end_time,
>>              s.slot_name,
>> +            s.remote_server,
>> +            s.remote_port,
>>
>> As the column names, aren't sender_host and sender_port more intuitive
>> rather than remote_server and remote_port?
> 
> OK. Changed accordingly.

No problems with those names.

+       ret = PQhost(conn->streamConn);
+       if (ret && (strcmp(ret,"") != 0))
+               *sender_host = pstrdup(ret);
The code tends to use more strlen to check for empty strings,
particularly libpq.  A small nit it is.
--
Michael

Commits

  1. Enhance pg_stat_wal_receiver view to display host and port of sender server.

  2. Allow multiple hostaddrs to go with multiple hostnames.

  3. libpq: Fix inadvertent change in PQhost() behavior.

  4. libpq: Allow connection strings and URIs to specify multiple hosts.