Re: [RESEND] Transaction auto-abort causes grief with Spring Framework - Mailing list pgsql-general

From Gregory Stark
Subject Re: [RESEND] Transaction auto-abort causes grief with Spring Framework
Date
Msg-id 87bqd6u5ki.fsf@oxford.xeocode.com
Whole thread Raw
In response to [RESEND] Transaction auto-abort causes grief with Spring Framework  (Tyson Lloyd Thwaites <tyson.lloydthwaites@allianza.com.au>)
Responses Re: [RESEND] Transaction auto-abort causes grief with Spring Framework  (Tyson Lloyd Thwaites <tyson.lloydthwaites@allianza.com.au>)
List pgsql-general
"Tyson Lloyd Thwaites" <tyson.lloydthwaites@allianza.com.au> writes:

> Normally if we catch the exception, other dbs (Oracle, MSSQL) will let us
> keep going.

How do you catch exceptions in these other dbs?

The way to do it in Postgres is with the SAVEPOINT command.

> For example, if something goes wrong, I can't even write an event row to our
> auditing table!

This is actually a somewhat more complex example than handling an expected
error. For audit records you really want to be able to commit the audit record
independently of the rest of the transaction. These are called "autonomous
transactions" and there's no built-in support for them in Postgres but you can
put together something equivalent using dblink or a second client connection.

--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com

pgsql-general by date:

Previous
From: "Phoenix Kiula"
Date:
Subject: Re: Strange inconsistency with UPDATE
Next
From: Tyson Lloyd Thwaites
Date:
Subject: Re: [RESEND] Transaction auto-abort causes grief with Spring Framework