On 2025-Feb-21, Sami Imseih wrote:
> > If we want to include 'role' in this output, what I'd propose is to
> > have \conninfo issue "SHOW role", which is accepted by every server
> > version. If it fails (say because we're in an aborted transaction),
> > just omit that row from the output.
>
> v37- would have handled this as the list of PQ parameters was
> dynamically generated and only those parameters
> reported by the specific version of the server showed up in
> \conninfo+.
Okay, I have pushed this with some trivial tweaks -- removed the
question marks and capitalized a couple of words. I also changed "Port"
to "Server Port" because I wasn't sure it was obvious it was that, and
maybe we want to list the client port as well (like pg_stat_activity
does).
We can continue to discuss adding 'role', 'server authorization' and so
on, if people think they are going to be useful. We can consider such a
decision an open item for 18.
I tried it with 9.2, which doesn't have in_hot_standby. It shows like
this
55441 18devel 356833=# \conninfo
Connection Information
Parameter │ Value
──────────────────────┼────────────────────────
Database │ alvherre
Client User │ alvherre
Host │ localhost
Host Address │ ::1
Server Port │ 55441
Options │
Protocol Version │ 3
Password Used │ false
GSSAPI Authenticated │ false
Backend PID │ 356833
TLS Connection │ true
TLS Library │ OpenSSL
TLS Protocol │ TLSv1.3
TLS Key Bits │ 256
TLS Cipher │ TLS_AES_256_GCM_SHA384
TLS Compression │ false
ALPN │ none
Superuser │ on
Hot Standby │ unknown
(19 rows)
I think "unknown" here is okay, though we could probably say
"unsupported by server" or just set it to null.
Note that the boolean for superuser says 'on' instead of 'true'. Maybe
we should make all the booleans use on/off instead of true/false? Not
sure.
Now we need someone to implement the PQsslAttribute() equivalent for
GSS! If only to prove that the effort of tweaking the TLS layer to
support multiple libraries ...
Also, there's a bunch of "(char *)" casts that are 100% due to
printTableAddCell() taking a char * instead of const char * for the cell
value. That seems a bit silly, we should change that.
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/