Re: Customize psql prompt to show current_role

From: Dominique Devienne <ddevienne(at)gmail(dot)com>
To: Erik Wienhold <ewie(at)ewie(dot)name>
Cc: 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 12:59:43
Message-ID: CAFCRh--uBYcJ0gyBakSAzby0CmM2gvjo4Wa9OF79Od+-PXQP0A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Sep 23, 2024 at 2:51 PM Erik Wienhold <ewie(at)ewie(dot)name> wrote:
> You could instead use this:
>
> SELECT current_role \gset
> \set PROMPT1 '%n(at)%/ (%:current_role:)=%# '
>
> But that won't work with subsequent SET ROLE commands.

Bummer... That was kinda the point, that it updates automatically.

Then I'd like to respectfully request a small enhancement to psql
to support a new \r (or some other letter) for current_role in the prompt.

Thanks, --DD

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Sabino Mullane 2024-09-23 13:02:57 Re: Customize psql prompt to show current_role
Previous Message Dominique Devienne 2024-09-23 12:56:33 Re: Why no pg_has_role(..., 'ADMIN')?