I suggest the attached, which gets 99% there with 10% of the
complexity, and has \conninfo (no plus sign) output this:
Connection Information
Parámetro │ Valor
───────────────────────┼────────────────────────
Base de Datos │ alvherre
Client User │ alvherre
Host │ 192.168.178.37
Port │ 55432
Opciones │
Protocol Version │ 3
Password Used? │ false
GSSAPI Authenticated? │ false
Backend PID │ 1589499
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 │ postgresql
Superuser? │ on
Hot standby? │ off
(18 filas)
I have added the parameters is_superuser and in_hot_standby only, and
stayed away from the libpq part of the patch to enumerate parameters.
ISTM a hardcoded list is fine.
Maybe keeping track of 'role' via ParameterStatus messages is a good
idea for reasons unrelated to this patch -- maybe it can be useful for
applications to be aware of role changes -- but I'm not 100% sure about
that, and in particular I'm not sure how heavy the protocol traffic is
going to be if such messages are emitted every time you run a security
invoker function or things like that. So I'm leaving that part out for
now, and it's easy to do both the libpq patch and \conninfo.
Also, I don't see why we have to keep the current free-format \conninfo.
When you run a query, you get things like
# select 99 as "Luftballons";
Luftballons
─────────────
99
You don't get "There were only 99 Luftballons" or any such nonsense, and I
don't see why \conninfo gets to play different rules. So I got rid of
\conninfo+.
Do people hate the question marks?
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/