public inbox for [email protected]
help / color / mirror / Atom feedFrom: Nathan Bossart <[email protected]>
To: Jim Jones <[email protected]>
Cc: Maiquel Grassi <[email protected]>
Cc: Pavel Luzanov <[email protected]>
Cc: Erik Wienhold <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Psql meta-command conninfo+
Date: Fri, 16 Feb 2024 09:54:49 -0600
Message-ID: <20240216155449.GA1236054@nathanxps13> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<CP4P284MB24830F5BF17FFA7F3D733142EC452@CP4P284MB2483.BRAP284.PROD.OUTLOOK.COM>
<[email protected]>
<CP8P284MB249652F5F0BE828C20A38348EC442@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM>
<[email protected]>
<CP8P284MB2496C7F14594722472C9FEBAEC482@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM>
<[email protected]>
<CP8P284MB24969B39579E808F9F44CCF8EC4D2@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM>
<CP8P284MB249664C44A1793823C4546F8EC4D2@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM>
<[email protected]>
Thanks for your work on this. I haven't been keeping up with the
discussion, but I took a quick look at the latest patch.
+ <para>
+ "Database", "Authenticated User", "System User" (only for PostgreSQL 16 or higher),
+ "Current User", "Session User", "Backend PID", "Server Address", "Server Port",
+ "Client Address", "Client Port", "Socket Directory", and "Host" columns are listed
+ by default when <literal>\conninfo+</literal> is invoked. The columns "Encryption",
+ "Protocol", "Cipher", and "Compression" are added to this output when TLS (SSL)
+ authentication is used. The same applies to GSS authentication is used, where the
+ "GSSAPI" column is also added to the <literal>\conninfo+</literal> output.
</para>
I might be alone on this, but I think this command should output the same
columns regardless of the version, whether it's using SSL, etc. and just
put NULL in any that do not apply. IMHO that would simplify the code and
help prevent confusion. Plus, I'm not aware of any existing meta-commands
that provide certain columns conditionally.
+ if (PQsslInUse(pset.db))
+ {
+ protocol = PQsslAttribute(pset.db, "protocol");
+ cipher = PQsslAttribute(pset.db, "cipher");
+ compression = PQsslAttribute(pset.db, "compression");
+ appendPQExpBuffer(&buf,
+ " ,'SSL' AS \"Encryption\",\n"
+ " '%s' AS \"Protocol\",\n"
+ " '%s' AS \"Cipher\",\n"
+ " '%s' AS \"Compression\"\n",
+ protocol ? protocol : _("unknown"),
+ cipher ? cipher : _("unknown"),
+ (compression && strcmp(compression, "off") != 0) ? _("on") : _("off"));
+ }
Could we pull some of this information from pg_stat_ssl instead of from
libpq? The reason I suggest this is because I think it would be nice if
the query that \conninfo+ uses could be copy/pasted as needed and not rely
on hard-coded values chosen by the client.
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
view thread (43+ messages) latest in thread
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]
Subject: Re: Psql meta-command conninfo+
In-Reply-To: <20240216155449.GA1236054@nathanxps13>
* 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