Re: Psql meta-command conninfo+

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Cc: Hunaid Sohail <hunaidpgml(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Maiquel Grassi <grassi(at)hotmail(dot)com(dot)br>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, "Imseih (AWS), Sami" <simseih(at)amazon(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Pavel Luzanov <p(dot)luzanov(at)postgrespro(dot)ru>, Erik Wienhold <ewie(at)ewie(dot)name>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Psql meta-command conninfo+
Date: 2024-09-16 14:22:03
Message-ID: 202409161422.gbsj4m6k5gy5@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anton A. Melnikov 2024-09-16 14:30:35 Re: May be BUG. Periodic burst growth of the checkpoint_req counter on replica.
Previous Message Tomas Vondra 2024-09-16 14:19:29 Re: scalability bottlenecks with (many) partitions (and more)