Re: Avoid transaction abot if/when constraint violated - Mailing list pgsql-general

From Joshua D. Drake
Subject Re: Avoid transaction abot if/when constraint violated
Date
Msg-id 1263512114.20966.824.camel@jd-desktop.iso-8859-1.charter.com
Whole thread Raw
In response to Avoid transaction abot if/when constraint violated  ("Gauthier, Dave" <dave.gauthier@intel.com>)
List pgsql-general
On Thu, 2010-01-14 at 15:12 -0700, Gauthier, Dave wrote:
> Hello !
>
>
>
> I have a long list of records I want to insert into a table in such a
> way as I can trap and report any/all constraint violations before
> rolling back (or opting to commit).  Unfortunately, after I hit the
> first constraint violation, it aborts the transaction, and then
> reports “ERROR: current transaction is aborted, commands ignored until
> end of transaction block”.
>
>
>
> Is there a way around this?

Only if it is a foreign key issue in which case you can defer the check.

If it is a single transaction, and you insert a bad record the whole
transaction fails.

Joshua D. Drake


>
>
>
> Thanks in Advance!
>
>


--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 503.667.4564
Consulting, Training, Support, Custom Development, Engineering
Respect is earned, not gained through arbitrary and repetitive use or Mr. or Sir.


pgsql-general by date:

Previous
From: Ben Chobot
Date:
Subject: vacuum issues under load?
Next
From: Vincenzo Romano
Date:
Subject: Re: R: Re: R: Re: Weird EXECUTE ... USING behaviour