Re: proposal: psql: show current user in prompt - Mailing list pgsql-hackers

From Robert Haas
Subject Re: proposal: psql: show current user in prompt
Date
Msg-id CA+TgmoaPGWW5HGvBF0C0oNpo7FuDxVJTP06PtTWoHQSeV+U-Zg@mail.gmail.com
Whole thread Raw
In response to Re: proposal: psql: show current user in prompt  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: proposal: psql: show current user in prompt
List pgsql-hackers
On Wed, Apr 5, 2023 at 11:34 AM Pavel Stehule <pavel.stehule@gmail.com> wrote:
> If the GUC_REPORT should not  be used, then only one possibility is enhancing the protocol, about the possibility to
readsome predefined server's features from the client. 
> It can be much cheaper than SQL query, and it can be used when the current transaction is aborted. I can imagine a
possibilityto read server time or a server session role from a prompt processing routine. 
>
> But for this specific case, you need to cache the role name somewhere. You can simply get oid everytime, but for role
nameyou need to access to system catalogue, and it is not possible in aborted transactions. So at the end, you probably
shouldread "role" GUC. 
>
> Can this design be  acceptable?

I don't think we want to add a dedicated protocol message that says
"send me the role GUC right now". I mean, we could, but being able to
tell the GUC mechanism "please send me the role GUC after every
command" sounds a lot easier to use.

--
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: Why enable_hashjoin Completely disables HashJoin
Next
From: Daniel Gustafsson
Date:
Subject: Re: Should vacuum process config file reload more often