> or > > write two new functions PQconnhost() and PQconnhostaddr() to return the > connected host and hostaddr and reuse the PQport() function.
How about using an API similar to PQconninfo, where we return an array of connection options used? Say, PQeffectiveConninfo(). This seems to me to reduce ugliness in the API, and be more generally useful.
OK. Added the new API PQeffectiveConninfo() that returns all the connection
options that are actively used. Currently the connection options host, hostaddr
and port may change based on the active connection and rest of the options
may be same.
walrecvr could display as an array or just flatten to a string -- not sure what's the better option there.
Currently I went with a string model to display all the effective_conninfo
options. I feel if we go with string approach, adding a new option that gets
updated in future is simple.
postgres=# select conninfo, effective_conninfo from pg_stat_wal_receiver;
-[ RECORD 1 ]------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------