pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Bart Degryse <Bart.Degryse@indicator.be>
Cc: pgsql-sql@postgresql.org
Subject: Re: Transactions and Exceptions
Date: Fri, 22 Jun 2007 14:24:49 +0100
Message-ID: <467BCDA1.9070606@archonet.com> (raw)
In-Reply-To: <467BE1BB.A3DD.0030.0@indicator.be>
References: <467BE1BB.A3DD.0030.0@indicator.be>

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



view thread (5+ messages)  latest in thread

Message-ID: <467BCDA1.9070606@archonet.com>
Permalink:  ../467BCDA1.9070606@archonet.com/
Also on:    postgresql.org/message-id/467BCDA1.9070606@archonet.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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, Bart.Degryse@indicator.be
  Subject: Re: Transactions and Exceptions
  In-Reply-To: <467BCDA1.9070606@archonet.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