Re: Psql meta-command conninfo+ - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Psql meta-command conninfo+
Date
Msg-id 202409161422.gbsj4m6k5gy5@alvherre.pgsql
Whole thread Raw
In response to Re: Psql meta-command conninfo+  (Jim Jones <jim.jones@uni-muenster.de>)
Responses Re: Psql meta-command conninfo+
List pgsql-hackers
On 2024-Sep-16, Jim Jones wrote:

> * 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?

It is intended.  As Peter said[1], what we wanted was to display
client-side info, so PQuser() is the right thing to do.  Now maybe
"Current User" is not the perfect column header, but at least the
definition seems consistent with the desired end result.  Now, I think
the current docs saying to look at session_user() are wrong, they should
point to the libpq docs for the function instead; something like "The
name of the current user, as returned by PQuser()" and so on.
Otherwise, in the cases where these things differ, it is going to be
hard to explain.

[1] https://postgr.es/m/f4fc729d-7903-4d58-995d-6cd146049992@eisentraut.org

> * "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..

Yeah, I think we should print what a boolean value would look like from
SQL, so "true" rather than "yes".


I think the code structure is hard to follow.  It would be simpler if it
was a bunch of

/* Database */
printTableAddHeader(&cont, _("Database"), true, 'l');
printTableAddCell(&cont, db, false, false);
...
/* Port */
printTableAddHeader(&cont, _("Por"), true, 'l');
printTableAddCell(&cont, PQport(pset.db), false, false);
/* ... */

And so on.  I don't think the printTable() API forces you to set all
headers first followed by all cells.

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: scalability bottlenecks with (many) partitions (and more)
Next
From: Tom Lane
Date:
Subject: Re: Regression tests fail with tzdata 2024b