Re: Customize psql prompt to show current_role

From: Dominique Devienne <ddevienne(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Erik Wienhold <ewie(at)ewie(dot)name>, Asad Ali <asadalinagri(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Customize psql prompt to show current_role
Date: 2024-09-23 15:07:47
Message-ID: CAFCRh--cXUafqTO8eANpQh2Bve+1o7YtWSC1+F8aQ9rvA+MbUA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Sep 23, 2024 at 4:55 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> 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%40mail.gmail.com
>
> 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.

Therefore I want to respectfully re-iterate my interest in this enhancement.

Thanks, --DD

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Wizard Brony 2024-09-23 15:15:20 Repeatable Read Isolation Level "transaction start time"
Previous Message Tom Lane 2024-09-23 14:54:55 Re: Customize psql prompt to show current_role