Search Postgresql Archives

Re: Customize psql prompt to show current_role

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 23, 2024 at 3:05 PM Laurenz Albe <laurenz.albe@xxxxxxxxxxx> wrote:
> On Mon, 2024-09-23 at 14:59 +0200, Dominique Devienne wrote:
> > On Mon, Sep 23, 2024 at 2:51 PM Erik Wienhold <ewie@xxxxxxxxx> 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.
>
> To get the current role, psql would have to query the database whenever
> it displays the prompt.  That would be rather expensive...

Hi Laurenz. Sure, although expensive might be a bit strong a word.
But that would be opt-in anyway, so just a small warning in the doc
about that new option would suffice, no? --DD






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux