Re: Customize psql prompt to show current_role - Mailing list pgsql-general

From Dominique Devienne
Subject Re: Customize psql prompt to show current_role
Date
Msg-id CAFCRh--uBYcJ0gyBakSAzby0CmM2gvjo4Wa9OF79Od+-PXQP0A@mail.gmail.com
Whole thread Raw
In response to Re: Customize psql prompt to show current_role  (Erik Wienhold <ewie@ewie.name>)
Responses Re: Customize psql prompt to show current_role
List pgsql-general
On Mon, Sep 23, 2024 at 2:51 PM Erik Wienhold <ewie@ewie.name> wrote:
> You could instead use this:
>
>     SELECT current_role \gset
>     \set PROMPT1 '%n@%/ (%: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



pgsql-general by date:

Previous
From: Dominique Devienne
Date:
Subject: Re: Why no pg_has_role(..., 'ADMIN')?
Next
From: Greg Sabino Mullane
Date:
Subject: Re: Customize psql prompt to show current_role