Re: Error on failed COMMIT

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>
Cc: Dave Cramer <davecramer(at)postgres(dot)rocks>, Robert Haas <robertmhaas(at)gmail(dot)com>, Shay Rojansky <roji(at)roji(dot)org>, "Haumacher, Bernhard" <haui(at)haumacher(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Error on failed COMMIT
Date: 2020-02-24 22:59:37
Message-ID: CAHyXU0x4m+au4C0REYpX-X-5_=0YH3b9KUD4zUQhB-Dw1kLkNg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 24, 2020 at 4:06 PM Vladimir Sitnikov
<sitnikov(dot)vladimir(at)gmail(dot)com> wrote:
>
> Merlin>My biggest sense of alarm with the proposed change is that it could
> Merlin>leave applications in a state where the transaction is hanging there
>
> How come?
> The spec says commit ends the transaction.
> Can you please clarify where the proposed change leaves a hanging transaction?
>
> Just in case, the proposed change is as follows:
>
> postgres=# begin;
> BEGIN
> postgres=# aslkdfasdf;
> ERROR: syntax error at or near "aslkdfasdf"
> LINE 1: aslkdfasdf;
> ^
> postgres=# commit;
> ROLLBACK <-- this should be replaced with "ERROR: can't commit the transaction because ..."
> postgres=# commit;
> WARNING: there is no transaction in progress <-- this should be as it is currently. Even if commit throws an error, the transaction should be terminated.
> COMMIT

Ok, you're right; I missed the point in that it's not nearly as bad as
I thought you were suggesting (to treat commit as bad statement) but
the transaction would still terminate. Still, this is very sensitive
stuff, do you think most common connection poolers would continue to
work after making this change?

merlin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2020-02-24 23:19:58 Re: Ought to use heap_multi_insert() for pg_attribute/depend insertions?
Previous Message Alexander Korotkov 2020-02-24 22:54:10 Re: Improve search for missing parent downlinks in amcheck