Re: Error on failed COMMIT

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Dave Cramer <davecramer(at)postgres(dot)rocks>
Cc: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, Tony Locke <tlocke(at)tlocke(dot)org(dot)uk>, Shay Rojansky <roji(at)roji(dot)org>, Bruce Momjian <bruce(at)momjian(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Vik Fearing <vik(at)postgresfriends(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>, "Haumacher, Bernhard" <haui(at)haumacher(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Error on failed COMMIT
Date: 2021-01-26 17:46:10
Message-ID: c7f56be7a2433b3e25768ca6611f974c446cbea6.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2021-01-26 at 12:25 -0500, Dave Cramer wrote:
> > After thinking some more about it, I think that COMMIT AND CHAIN would have
> > to change behavior: if COMMIT throws an error (because the transaction was
> > aborted), no new transaction should be started. Everything else seems fishy:
> > the statement fails, but still starts a new transaction?
> >
> > I guess that's also at fault for the unexpected result status that
> > Masahiko complained about in the other message.
>
>
> I haven't had a look at the result status in libpq. For JDBC we don't see that.
> We throw an exception when we get this error report. This is very consistent as the commit fails and we throw an exception
>
> > So I think we should not introduce USER_ERROR at all. It is too much
> > of a kluge: fail, but not really...
>
> What we do now is actually worse as we do not get an error report and we silently change commit to rollback.
> How is this better ?

I see your point from the view of the JDBC driver.

It just feels hacky - somewhat similar to what you say
above: don't go through the normal transaction rollback steps,
but issue an error message.

At least we should fake it well...

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2021-01-26 17:54:26 Re: {CREATE INDEX, REINDEX} CONCURRENTLY improvements
Previous Message Vik Fearing 2021-01-26 17:37:47 Re: Error on failed COMMIT