Re: [RESEND] Transaction auto-abort causes grief with Spring Framework

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tyson Lloyd Thwaites" <tyson(dot)lloydthwaites(at)allianza(dot)com(dot)au>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: [RESEND] Transaction auto-abort causes grief with Spring Framework
Date: 2007-08-17 04:51:25
Message-ID: 87bqd6u5ki.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


"Tyson Lloyd Thwaites" <tyson(dot)lloydthwaites(at)allianza(dot)com(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tyson Lloyd Thwaites 2007-08-17 05:04:26 Re: [RESEND] Transaction auto-abort causes grief with Spring Framework
Previous Message apitt 2007-08-17 04:44:52 Finding my database