public inbox for [email protected]  
help / color / mirror / Atom feed
From: Adrian Klaver <[email protected]>
To: Dominique Devienne <[email protected]>
To: Tom Lane <[email protected]>
Cc: Laurenz Albe <[email protected]>
Cc: Erik Wienhold <[email protected]>
Cc: Asad Ali <[email protected]>
Cc: [email protected]
Subject: Re: Customize psql prompt to show current_role
Date: Mon, 23 Sep 2024 08:16:53 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAFCRh--cXUafqTO8eANpQh2Bve+1o7YtWSC1+F8aQ9rvA+MbUA@mail.gmail.com>
References: <CAFCRh-_VwScttZi4R8grSd-b=7qguAnSzXp_+jbdpUkp=TfxPQ@mail.gmail.com>
	<CAJ9xe=ttSfESR=z2YZycow8DubyfQeOgOzMDUCE95f2vN-TzFg@mail.gmail.com>
	<[email protected]>
	<CAFCRh--uBYcJ0gyBakSAzby0CmM2gvjo4Wa9OF79Od+-PXQP0A@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<CAFCRh--cXUafqTO8eANpQh2Bve+1o7YtWSC1+F8aQ9rvA+MbUA@mail.gmail.com>

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]







view thread (2+ 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], [email protected]
  Subject: Re: Customize psql prompt to show current_role
  In-Reply-To: <[email protected]>

* 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