Catching errors inside transactions - Mailing list pgsql-novice

From John Taylor
Subject Catching errors inside transactions
Date
Msg-id 02051514253701.01476@splash.hq.jtresponse.co.uk
Whole thread Raw
Responses Re: Catching errors inside transactions  (Manuel Sugawara <masm@fciencias.unam.mx>)
Re: Catching errors inside transactions  (John Taylor <postgres@jtresponse.co.uk>)
List pgsql-novice
Hi all,

I'm accessing postgres (7.1) through JDBC.

My application performs a number of UPDATEs, and INSERTs to the database.
If there are any SQL errors, I catch them and deal with them as appropriate
in my code.

However, I now want to put these inside a transaction.

This all works fine, except that if there is an error, postgress automatically
rolls back the transaction, even though I COMMIT at the end.

Is there a way I can stop the errors causing the transaction to fail, or to force
the transaction to commit ?

I don't really want to explicitly check for the existence of a record before an UPDATE/INSERT,
as errors are the exception.


Any ideas ?

Thanks
JohnT


pgsql-novice by date:

Previous
From: Chris Thompson
Date:
Subject: trigger, transactions, eek
Next
From: gerry.smit@lombard.ca
Date:
Subject: Trouble with index in 7.1