Re: Error on failed COMMIT

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: Error on failed COMMIT
Дата
Msg-id CADK3HHLha_oyFr2-p_3c9F5ROZeQ5HHSHhyUp-kSoVZ3yMxjoA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Error on failed COMMIT  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-hackers


On Mon, 24 Feb 2020 at 17:59, Merlin Moncure <mmoncure@gmail.com> wrote:
On Mon, Feb 24, 2020 at 4:06 PM Vladimir Sitnikov
<sitnikov.vladimir@gmail.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?

Don't see why not. All that happens is that an error message is emitted by the server on commit instead of silently rolling back

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Daniel Gustafsson
Дата:
Сообщение: Re: Ought to use heap_multi_insert() for pg_attribute/dependinsertions?
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Ought to use heap_multi_insert() for pg_attribute/dependinsertions?