public inbox for [email protected]  
help / color / mirror / Atom feed
From: Jim Jones <[email protected]>
To: Hunaid Sohail <[email protected]>
To: [email protected]
Cc: Alvaro Herrera <[email protected]>
Cc: Maiquel Grassi <[email protected]>
Cc: Nathan Bossart <[email protected]>
Cc: Imseih (AWS), Sami <[email protected]>
Cc: Peter Eisentraut <[email protected]>
Cc: Pavel Luzanov <[email protected]>
Cc: Erik Wienhold <[email protected]>
Cc: Tom Lane <[email protected]>
Subject: Re: Psql meta-command conninfo+
Date: Mon, 16 Sep 2024 15:40:07 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAMWA6yYHBPwqkf=6j=+CumyzenC2FWhKwLukviTcF9hkeFdKcA@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<CAMWA6yYHBPwqkf=6j=+CumyzenC2FWhKwLukviTcF9hkeFdKcA@mail.gmail.com>



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






view thread (3+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Psql meta-command conninfo+
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox