insert continue on error

From: Tom Hart <tomhart(at)coopfed(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: insert continue on error
Date: 2007-10-16 19:37:46
Message-ID: 4715130A.7020102@coopfed.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello everybody.

I'm trying to migrate our data mine from a MS Access backend to a
postgresql backend, and I'm bumping into problems with the conversion.
I've got the basic db and tables set up. I want to transfer data from
one table to another with insert into ... select from. The from table
and into table both have the same field names, but the types for the
first are all text, and the second are specific (boolean, numeric(10,2),
etc), with cast and custom conversion functions doing the translation.
However every once in a while a record will contain data that I didn't
forsee/wasn't cast properly and the record will bounce. This of course
aborts the entire process.

What I'd like to know is if there's a way to have postgresql still
insert the other rows, and either bounce the bad row to another table,
or log the error in another table/file. I'm sure there's a way to do
this, but I'm still pretty new to postgresql.

TIA for any assistance you can give me.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2007-10-16 19:46:54 Re: improvement proposition
Previous Message Richard Huxton 2007-10-16 19:27:50 Re: need help with rebuilding postgresql