Re: Transactions and Exceptions

From: Richard Huxton <dev(at)archonet(dot)com>
To: Bart Degryse <Bart(dot)Degryse(at)indicator(dot)be>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Transactions and Exceptions
Date: 2007-06-22 13:24:49
Message-ID: 467BCDA1.9070606@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bart Degryse 2007-06-22 13:52:37 Re: Transactions and Exceptions
Previous Message Bart Degryse 2007-06-22 12:50:37 Transactions and Exceptions