Re: Transactions and Exceptions - Mailing list pgsql-sql

From Richard Huxton
Subject Re: Transactions and Exceptions
Date
Msg-id 467BCDA1.9070606@archonet.com
Whole thread Raw
In response to Transactions and Exceptions  ("Bart Degryse" <Bart.Degryse@indicator.be>)
Responses Re: Transactions and Exceptions  ("Bart Degryse" <Bart.Degryse@indicator.be>)
List pgsql-sql
Bart Degryse wrote:
> Dear all,
> I'm having a problem with transactions and exceptions and need your advice.
> I want a function to do two things: 
> - log something to a table (which is basically an insert)
> - raise an exception under certain conditions
> My problem is that when I raise the exception the insert is rolled back.
> How can I work around that?

Either:
1. Not raising an exception, instead returning a status code to the 
application.

2. Using dblink / dbi-link to reconnect to the database, which means 
your logging will take place in its own transaction.

--   Richard Huxton  Archonet Ltd


pgsql-sql by date:

Previous
From: "Bart Degryse"
Date:
Subject: Transactions and Exceptions
Next
From: "Bart Degryse"
Date:
Subject: Re: Transactions and Exceptions