Re: Aborting transaction on error

From: Mark Rae <m(dot)rae(at)inpharmatica(dot)co(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Aborting transaction on error
Date: 2002-03-04 11:28:20
Message-ID: 3C835A54.B45DF1F7@inpharmatica.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)rae(at)inpharmatica(dot)co(dot)uk http://www.inpharmatica.co.uk/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martina Mostert 2002-03-04 11:28:58 Arrays in pgsql
Previous Message hubert depesz lubaczewski 2002-03-04 11:05:09 copying database?