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

From Tom Lane
Subject Re: Customize psql prompt to show current_role
Date
Msg-id 3085360.1727105807@sss.pgh.pa.us
Whole thread Raw
In response to Re: Customize psql prompt to show current_role  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
Adrian Klaver <adrian.klaver@aklaver.com> writes:
> 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.

Worse than that: what it reports is libpq's PQuser(), that is the
name that was used to log in with.  But if what you want is the
session_user, psql prompts already have %n for that.

            regards, tom lane



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Customize psql prompt to show current_role
Next
From: Dominique Devienne
Date:
Subject: Re: Customize psql prompt to show current_role