Re: proposal: psql: show current user in prompt

From: Jelte Fennema <postgres(at)jeltef(dot)nl>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kirk Wolak <wolakk(at)gmail(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: proposal: psql: show current user in prompt
Date: 2023-09-11 11:59:50
Message-ID: CAGECzQQ70=rrn4i-LZxgeOJOvWpLaL-RuE=xV0HBa+WPiMxBcQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

@Tom and @Robert, since you originally suggested extending the
protocol for this, I think some input from you on the protocol design
would be quite helpful. BTW, this protocol extension is the main
reason I personally care for this patch, because it would allow
PgBouncer to ask for updates on certain GUCs so that it can preserve
session level SET commands even in transaction pooling mode.
Right now PgBouncer can only do this for a handful of GUCs, but
there's quite a few others that are useful for PgBouncer to preserve
by default:
- search_path
- statement_timeout
- lock_timeout

And users might have others that they want to preserve others too.

On Fri, 8 Sept 2023 at 21:08, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>> I think we'll need some bikeshedding on what the protocol message
>> should look like exactly. I'm not entirely sure what is the most
>> sensible here, so please treat everything I write next as
>> suggestions/discussion:
>> I see that you're piggy-backing on PQsendTypedCommand, which seems
>> nice to avoid code duplication. It has one downside though: not every
>> type, is valid for each command anymore.
>> One way to avoid that would be to not introduce a new command, but
>> only add a new type that is understood by Describe and Close, e.g. a
>> 'G' (for GUC). Then PqMsg_Describe, G would become the equivalent of
>> what'the current patch its PqMsg_ReportGUC, 't' and PqMsg_Close, G
>> would be the same as PqMsg_ReportGUC, 'f'.
>
>
> I am sorry, I don't understand this idea?

To clarify what I meant: I meant instead of introducing a new top
level message type (i.e. your newly introduced ReportGUC message), I
suggested adding a new subtype that is understood by the Describe and
Close messages. In addition to being able to use Describe and Close
for statements and portals with the S and P subtypes respectively,
like you currently can, we could add a new subtype G which would start
and stop GUC reporting (with the Describe and Close message
respectively). I think that would make the client code even simpler than
it is now.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2023-09-11 12:00:00 Re: Cleaning up array_in()
Previous Message Martín Marqués 2023-09-11 11:55:53 Re: Possibility to disable `ALTER SYSTEM`