pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sebastien Flaesch <sebastien.flaesch@4js.com>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Transaction and SQL errors
Date: Mon, 4 Apr 2022 11:33:14 +0000
Message-ID: <DBAP191MB1289450C733A5A3662C2257EB0E59@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM> (raw)

Hello!

Is there any plan to have an equivalent of psql's

set ON_ERROR_ROLLBACK on

in the DB engine?

Most other DB engines have this behavior built-in, that makes migration to PostgreSQL more difficult when there are complex long transactions in the application code.

I do often suggest programmers to trust the DB engine regarding table constraints, and let the engine check unique / foreign keys, etc. However, these errors cancel the whole transaction and user code can't correct the last SQL statement and try a new execution, without losing everything since TX started...

Any thoughts?

Any arguments I could give to programmers?   Maybe:
"You better replay all SQL of the whole transaction... (and make them as short as possible!)"
?

Seb

view thread (11+ messages)  latest in thread

Message-ID: <DBAP191MB1289450C733A5A3662C2257EB0E59@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM>
Permalink:  ../DBAP191MB1289450C733A5A3662C2257EB0E59@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM/
Also on:    postgresql.org/message-id/DBAP191MB1289450C733A5A3662C2257EB0E59@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: sebastien.flaesch@4js.com
  Subject: Re: Transaction and SQL errors
  In-Reply-To: <DBAP191MB1289450C733A5A3662C2257EB0E59@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM>
  References: <DBAP191MB1289450C733A5A3662C2257EB0E59@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox