Re: Aborting transaction on error - Mailing list pgsql-general

From Mark Rae
Subject Re: Aborting transaction on error
Date
Msg-id 3C835A54.B45DF1F7@inpharmatica.co.uk
Whole thread Raw
In response to Re: Aborting transaction on error  ("Greg Sabino Mullane" <greg@turnstep.com>)
List pgsql-general
Greg Sabino Mullane wrote:
> > More specifically, I have some DBI scripts which under Oracle
> > just insert rows into a table with a unique constraint. If they
> > come across a duplicate row they detect and report this error and
> > continue. (The duplicates are discarded as they are not needed)
>
> So basically Oracle is reporting the problem and then moving on to
> the next record. If each insert is a separate transaction, this is
> perfectly understandable behavior.

No the whole thing is in one transaction, which is what I want so that
either all of the data from a particular file gets loaded or none of
it.

Oracle just reports the 'error' back through DBI::errstr and the
script can choose whether to abort the transaction or not. I was
hoping that there might be a way of making Postgres behave the same
way. i.e. The database just reports what happened and the user gets
to decide what constitutes a teminal error.

I had pretty much resigned myself to adding the duplicate checks,
I just wanted to make sure I had not overlooked an option somewhere
before I did so.

Thanks (also to the people who replied off list)

    -Mark

--
Mark Rae                                       Tel: +44(0)20 7074 4648
Inpharmatica                                   Fax: +44(0)20 7074 4700
m.rae@inpharmatica.co.uk                http://www.inpharmatica.co.uk/

pgsql-general by date:

Previous
From: Martina Mostert
Date:
Subject: Arrays in pgsql
Next
From: "Raymond O'Donnell"
Date:
Subject: Re: April 1