From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Jelte Fennema <postgres(at)jeltef(dot)nl> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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-08-11 06:34:09 |
Message-ID: | CAFj8pRBAS6SV48eOkDv+GgdD=Pw-iTKSg+X4ZN9Th55oDfiHeA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
čt 10. 8. 2023 v 16:31 odesílatel Jelte Fennema <postgres(at)jeltef(dot)nl> napsal:
> On Thu, 10 Aug 2023 at 14:44, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> wrote:
> > čt 10. 8. 2023 v 14:05 odesílatel Jelte Fennema <postgres(at)jeltef(dot)nl>
> napsal:
> >> That it is not rolled-back
> >> in a case like this?
> >>
> >> BEGIN;
> >> \set PROMPT '%N'
> >> ROLLBACK;
> >
> >
> > surely not.
> >
> > \set is client side setting, and it is not transactional. Attention -
> "\set" and "set" commands are absolutely different creatures.
>
> To clarify: I agree it's the desired behavior that \set is not rolled back.
>
> > It Would be strange (can be very messy) if I had a message like "cannot
> set a prompt, because you should do ROLLBACK first"
>
> This was a very helpful sentence for my understanding. To double check
> that I'm understanding you correctly. This is the kind of case that
> you're talking about.
>
> postgres=# BEGIN;
> postgres=# SELECT some syntax error;
> ERROR: 42601: syntax error at or near "some"
> postgres=# \set PROMPT '%N'
> ERROR: 25P02: current transaction is aborted, commands ignored until
> end of transaction block
>
yes
>
> I agree that it should not throw an error like that. So indeed a
> dedicated message type is needed for psql too. Because any query will
> cause that error.
>
>
> But afaict there's no problem with using pqParseInput3() and
> PQexecFinish() even if the message isn't handled as part of the
> transaction. Some other messages that pqParseInput3 handles which are
> not part of the transaction are 'N' (Notice) and 'K' (secret key).
>
I have to recheck it
Regards
Pavel
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Smith | 2023-08-11 08:58:35 | logicalrep_worker_launch -- counting/checking the worker limits |
Previous Message | Ashutosh Bapat | 2023-08-11 06:32:59 | Re: logical decoding and replication of sequences, take 2 |