public inbox for [email protected]
help / color / mirror / Atom feedFrom: Dominique Devienne <[email protected]>
To: Adrian Klaver <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Laurenz Albe <[email protected]>
Cc: Erik Wienhold <[email protected]>
Cc: Asad Ali <[email protected]>
Cc: [email protected]
Subject: Re: Customize psql prompt to show current_role
Date: Mon, 23 Sep 2024 17:37:58 +0200
Message-ID: <CAFCRh-8=zWRpDXiVUUqtFN5F=xhYUqqtieA8Hg0NiCxqe+sESQ@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAFCRh-_VwScttZi4R8grSd-b=7qguAnSzXp_+jbdpUkp=TfxPQ@mail.gmail.com>
<CAJ9xe=ttSfESR=z2YZycow8DubyfQeOgOzMDUCE95f2vN-TzFg@mail.gmail.com>
<[email protected]>
<CAFCRh--uBYcJ0gyBakSAzby0CmM2gvjo4Wa9OF79Od+-PXQP0A@mail.gmail.com>
<[email protected]>
<[email protected]>
<CAFCRh--cXUafqTO8eANpQh2Bve+1o7YtWSC1+F8aQ9rvA+MbUA@mail.gmail.com>
<[email protected]>
On Mon, Sep 23, 2024 at 5:16 PM Adrian Klaver <[email protected]> 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
view thread (3+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Customize psql prompt to show current_role
In-Reply-To: <CAFCRh-8=zWRpDXiVUUqtFN5F=xhYUqqtieA8Hg0NiCxqe+sESQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox