Re: Customize psql prompt to show current_role

From: Raphael Salguero Aragón <raphael(dot)salguero(at)enterprisedb(dot)com>
To: Dominique Devienne <ddevienne(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, 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-11-27 14:14:04
Message-ID: E0C10F50-832E-43BB-AF10-C7D8DC057D9F@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Am 23.09.2024 um 17:37 schrieb Dominique Devienne <ddevienne(at)gmail(dot)com>:
>
> On Mon, Sep 23, 2024 at 5:16 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> wrote:
>> 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.
>
> yeah, sure, I realized that just after sending my last post...
> I resort to using both \conninfo *and* `select current_role`.
> I used \conninfo to tell me which server I'm on (since not
> on the default prompt, before I played with it today), which
> session_user I'm connected with (ddevienne or dd_login
> in my recent example), and finally `select current_role`
> which matters in my use-cases (session_user or dd_admin or dd_user).
>
> I'd like not to have to type those commands/queries all the time,
> and have them in the prompt at all time. I get that it's not for everyone,
> nor even necessary all the time, but I sincerely think it is definitely useful.
>
> I'd be glad to use Pavel's proposed %N. —DD
>

Hi all,

I just wanted to add that we are also supporting a larger customer with exactly the same request.
Perhaps this increases the value of the adjustment a little more :)

Best regards!
Raphael Salguero

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dominique Devienne 2024-11-27 14:45:05 Re: Customize psql prompt to show current_role
Previous Message Philip Couling 2024-11-27 12:05:59 Re: Validating check constraints without a table scan?