From: | Dimitri Fontaine <dfontaine(at)hi-media(dot)com> |
---|---|
To: | "Gauthier\, Dave" <dave(dot)gauthier(at)intel(dot)com> |
Cc: | "pgsql-general\(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Avoid transaction abot if/when constraint violated |
Date: | 2010-01-16 16:15:32 |
Message-ID: | m2d41am3ff.fsf@hi-media.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com> writes:
> 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?
Either load to another table with no constraint then use it as a source
for loading the constrained one, excluding the problematic rows:
INSERT INTO ... SELECT * FROM import.table LEFT JOIN ... ;
Or try using pgloader once the input format is CSV like rather than
INSERT.
Regards,
--
dim
From | Date | Subject | |
---|---|---|---|
Next Message | Mathieu De Zutter | 2010-01-16 18:02:30 | Constraint exclusion issue |
Previous Message | Oleg Bartunov | 2010-01-16 16:10:45 | Re: OR tsquery |