public inbox for [email protected]
help / color / mirror / Atom feedRe: Customize psql prompt to show current_role
2+ messages / 2 participants
[nested] [flat]
* Re: Customize psql prompt to show current_role
@ 2024-09-23 15:16 Adrian Klaver <[email protected]>
2024-09-23 15:36 ` Re: Customize psql prompt to show current_role Tom Lane <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Adrian Klaver @ 2024-09-23 15:16 UTC (permalink / raw)
To: Dominique Devienne <[email protected]>; Tom Lane <[email protected]>; +Cc: Laurenz Albe <[email protected]>; Erik Wienhold <[email protected]>; Asad Ali <[email protected]>; pgsql-general
On 9/23/24 08:07, Dominique Devienne wrote:
> On Mon, Sep 23, 2024 at 4:55 PM Tom Lane <[email protected]> wrote:
>> Laurenz Albe <[email protected]> writes:
>>> To get the current role, psql would have to query the database whenever
>>> it displays the prompt. That would be rather expensive...
>>
>> See previous discussion:
>> https://www.postgresql.org/message-id/flat/CAFj8pRBFU-WzzQhNrwRHn67N0Ug8a9-0-9BOo69PPtcHiBDQMA%40mai...
>>
>> At the time I didn't like the idea too much, but now that we've seen
>> a second independent request, maybe our opinion of its value should
>> go up a notch.
>
> Thanks for the reference Tom. I don't follow -hackers, so missed it.
>
> Obviously I disagree with your "it's not useful enough" comment :)
>
> I often lose track of which ROLE is active, in my many
> long-lived psql sessions, on various servers (mainly v14 and v16 these days),
> especially during my recent struggle to adapt our system to v16.
> I often resort to \conninfo, but it's less automatic and
> harder to visually parse (IMHO) compared to a custom ad-hoc prompt.
For me that shows the user that connected(session_user) not the
current_user.
>
> Therefore I want to respectfully re-iterate my interest in this enhancement.
>
> Thanks, --DD
>
>
--
Adrian Klaver
[email protected]
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Customize psql prompt to show current_role
2024-09-23 15:16 Re: Customize psql prompt to show current_role Adrian Klaver <[email protected]>
@ 2024-09-23 15:36 ` Tom Lane <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2024-09-23 15:36 UTC (permalink / raw)
To: Adrian Klaver <[email protected]>; +Cc: Dominique Devienne <[email protected]>; Laurenz Albe <[email protected]>; Erik Wienhold <[email protected]>; Asad Ali <[email protected]>; pgsql-general
Adrian Klaver <[email protected]> writes:
> On 9/23/24 08:07, Dominique Devienne wrote:
>> I often resort to \conninfo, but it's less automatic and
>> harder to visually parse (IMHO) compared to a custom ad-hoc prompt.
> For me that shows the user that connected(session_user) not the
> current_user.
Worse than that: what it reports is libpq's PQuser(), that is the
name that was used to log in with. But if what you want is the
session_user, psql prompts already have %n for that.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2024-09-23 15:36 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-09-23 15:16 Re: Customize psql prompt to show current_role Adrian Klaver <[email protected]>
2024-09-23 15:36 ` Tom Lane <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox