Re: proposal: psql: show current user in prompt

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kirk Wolak <wolakk(at)gmail(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: proposal: psql: show current user in prompt
Date: 2023-04-04 17:26:41
Message-ID: CAFj8pRBLSNRmO_a=YsEVfQKYK6Tr3ppcbkfDr46J+ALHBpFXpQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

út 4. 4. 2023 v 18:42 odesílatel Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> napsal:

> Kirk Wolak <wolakk(at)gmail(dot)com> writes:
> > Changed status to Ready for Committer. (100% Guessing here...)
>
> Basically, I want to reject this on the grounds that it's not
> useful enough to justify the overhead of marking the "role" GUC
> as GUC_REPORT. The problems with it not going to work properly
> with old servers are an additional reason not to like it.
>

If I understand to next comment correctly, the overhead should not be too
big

/*
* ReportChangedGUCOptions: report recently-changed GUC_REPORT variables
*
* This is called just before we wait for a new client query.
*
* By handling things this way, we ensure that a ParameterStatus message
* is sent at most once per variable per query, even if the variable
* changed multiple times within the query. That's quite possible when
* using features such as function SET clauses. Function SET clauses
* also tend to cause values to change intraquery but eventually revert
* to their prevailing values; ReportGUCOption is responsible for avoiding
* redundant reports in such cases.
*/

>
> But, if I lose the argument and we do commit this, I think it
> should just print an empty string when dealing with an old server.
> "ERR02000" is an awful idea, not least because it could be a
> real role name.
>

ok

>
> BTW, we should probably get rid of the PQuser() fallback in
> %n (session_username()) as well. It's unlikely that there are
> still servers in the wild that don't report "session_authorization",
> but if we did find one then the output is potentially misleading.
> I'd rather print nothing than something that might not be your
> actual session authorization setting.
>

It should be a separate patch?

Updated patch attached

Regards

Pavel

>
> regards, tom lane
>

Attachment Content-Type Size
psql-prompt-placeholder-N.patch text/x-patch 4.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2023-04-04 17:29:10 Re: psql: Add role's membership options to the \du+ command
Previous Message Tom Lane 2023-04-04 17:12:33 Re: psql: Add role's membership options to the \du+ command