Re: [transactions] soldier on anyway?

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: David Fetter <david(at)fetter(dot)org>, SF Postgres <sfpug(at)postgresql(dot)org>
Subject: Re: [transactions] soldier on anyway?
Date: 2003-11-14 03:35:38
Message-ID: 200311131935.38180.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: sfpug

David,

> I've got a transaction that does a few inserts, but it's OK for one
> specific one to fail in a specific way (adding a field that's already
> there).

> What's going on here, and how do I fix it?

In a short answer: you can't. Postgresql does not allow trapping of
exceptions; an exception will abort the transaction.

Your only reasonable option is to test for the failure condition in some way
to prevent an exception being raised.

(Your unreasonable option is to hack exception-handling for postgresql
transactions ...)

--
-Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Responses

Browse sfpug by date

  From Date Subject
Next Message David Fetter 2003-11-14 03:48:33 Re: [transactions] soldier on anyway?
Previous Message David Fetter 2003-11-14 03:33:00 [transactions] soldier on anyway?