Re: Possible to prevent transaction abort? - Mailing list pgsql-general

From Craig Ringer
Subject Re: Possible to prevent transaction abort?
Date
Msg-id 49FBBB92.1050000@postnewspapers.com.au
Whole thread Raw
In response to Possible to prevent transaction abort?  (Adam B <adamb@videx.com>)
List pgsql-general
Adam B wrote:
> Hello all,
>
> Is it possible to prevent Postgre from aborting the transaction upon a
> constraint violation?

Not without use of savepoints.

What I like to do is bulk-insert the suspect data into a temp table
without constraints, then INSERT INTO ... SELECT it into the target
table with appropriate WHERE constraints to prevent attempts to insert
invalid values.

Another alternative is to constrain each INSERT statement with an
appropriate WHERE clause after rephrasing it in INSERT INTO ... SELECT
form .

--
Craig Ringer

pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: recover corrupt DB?
Next
From: Tom Lane
Date:
Subject: Re: recover corrupt DB?