Re: Error on failed COMMIT - Mailing list pgsql-hackers

From Vik Fearing
Subject Re: Error on failed COMMIT
Date
Msg-id f99145dd-ec52-f2dd-cd25-39300d9bc09f@postgresfriends.org
Whole thread Raw
In response to Re: Error on failed COMMIT  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 12/02/2020 00:27, Tom Lane wrote:
> Vik Fearing <vik@postgresfriends.org> writes:
>> On 11/02/2020 23:35, Tom Lane wrote:
>>> So I assume you're imagining that that would leave us still in
>>> transaction-aborted state, and the session is basically dead in
>>> the water until the user thinks to issue ROLLBACK instead?
> 
>> Actually, I was imagining that it would end the transaction as it does
>> today, just with an error code.
>> This is backed up by General Rule 9 which says "The current
>> SQL-transaction is terminated."
> 
> Hm ... that would be sensible, but I'm not entirely convinced.  There
> are several preceding rules that say that an exception condition is
> raised, and normally you can stop reading at that point; nothing else
> is going to happen.  If COMMIT acts specially in this respect, they
> ought to say so.

Reading some more, I believe they do say so.

SQL:2016-2 Section 4.41 SQL-transactions:

    If an SQL-transaction is terminated by a <rollback statement> or
    unsuccessful execution of a <commit statement>, then all changes
    made to SQL-data or schemas by that SQL-transaction are canceled.

This to me says that an unsuccessful COMMIT still terminates the
transaction.
-- 
Vik Fearing



pgsql-hackers by date:

Previous
From: Vladimir Sitnikov
Date:
Subject: Re: Error on failed COMMIT
Next
From: Alexander Korotkov
Date:
Subject: Re: Improve search for missing parent downlinks in amcheck