On 16.09.24 08:51, Hunaid Sohail wrote:
> I have attached a new patch that now prints all info in tabular format
> for \conninfo+. I have also made the table output dynamic, so if the
> connection uses SSL, the columns in the table will expand accordingly.
>
It looks much cleaner now.
> I have also updated the documentation.
The CF bot is still giving some warnings:
command.c:886:79: error: ‘alpn’ may be used uninitialized
[-Werror=maybe-uninitialized]
886 | printTableAddCell(&cont,
(alpn && alpn[0] != '\0') ? alpn : _("none"), false, false);
|
~~~~^~~
command.c:803:50: note: ‘alpn’ was declared here
803 | *alpn;
| ^~~~
command.c:885:82: error: ‘compression’ may be used uninitialized
[-Werror=maybe-uninitialized]
885 | printTableAddCell(&cont,
(compression && strcmp(compression, "off") != 0) ? _("on") : _("off"),
false, false);
|
^~~~~~~~~~~~~~~~~~~~~~~~~~
command.c:802:50: note: ‘compression’ was declared here
802 | *compression,
| ^~~~~~~~~~~
command.c:884:41: error: ‘cipher’ may be used uninitialized
[-Werror=maybe-uninitialized]
884 | printTableAddCell(&cont,
cipher ? cipher : _("unknown"), false, false);
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
command.c:801:50: note: ‘cipher’ was declared here
801 | *cipher,
| ^~~~~~
command.c:883:41: error: ‘protocol’ may be used uninitialized
[-Werror=maybe-uninitialized]
883 | printTableAddCell(&cont,
protocol ? protocol : _("unknown"), false, false);
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
command.c:800:42: note: ‘protocol’ was declared here
800 | char *protocol,
| ^~~~~~~~
I have a few questions regarding this example:
$ /usr/local/postgres-dev/bin/psql -x "\
host=server.uni-muenster.de
hostaddr=192.168.178.27
user=jim dbname=db port=5432
sslmode=verify-full
sslrootcert=server-certificates/server.crt
sslcert=jim-certificates/jim.crt
sslkey=jim-certificates/jim.key"
psql (18devel)
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384,
compression: off, ALPN: postgresql)
Type "help" for help.
db=# SET ROLE foo;
SET
db=> SELECT current_user, session_user;
-[ RECORD 1 ]+----
current_user | foo
session_user | jim
db=> \conninfo+
Connection Information
-[ RECORD 1 ]--------+-----------------------
Database | db
Current User | jim
Session User | jim
Host | server.uni-muenster.de
Host Address | 192.168.178.27
Port | 5432
Protocol Version | 3
SSL Connection | yes
SSL Protocol | TLSv1.3
Cipher | TLS_AES_256_GCM_SHA384
Compression | off
ALPN | postgresql
GSSAPI Authenticated | no
Client Encoding | UTF8
Server Encoding | UTF8
Backend PID | 315187
* The value of "Current User" does not match the function current_user()
--- as one might expcect. It is a little confusing, as there is no
mention of "Current User" in the docs. In case this is the intended
behaviour, could you please add it to the docs?
* "SSL Connection" says "yes", but the docs say: "True if the current
connection to the server uses SSL, and false otherwise.". Is it supposed
to be like this? I haven't checked other similar doc entries..
--
Jim