ignore errors for COPY

From: Vangelis Katsikaros <ibob17(at)yahoo(dot)gr>
To: pgsql-general(at)postgresql(dot)org
Subject: ignore errors for COPY
Date: 2010-11-11 12:01:43
Message-ID: 4CDBDB27.1090508@yahoo.gr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

I have postrges 8.3.12 and I have the following issue:

I have a table
create table test(
table_id integer,
datetime timestamp,
MMSI integer,
lat real,
lng real,
);

and I bulk insert data to this table with COPY.

A tiny portion of the data in the file are wrong. For example one date
is "2009-93-29 05:27:08" which obviously has a wrong month (93). COPY
encounters this row and stop the insertion with
ERROR: date/time field value out of range: "2009-93-29 05:27:08"

Is there a way I can "turn" this error into a warning (or suppress the
error) and make COPY simply to skip this row?

I have a big amount of data (~100G) so iterating through them to find
all the possible wrong timestamp, reals, and integers will be quite
tedious and time consuming.

Regards
Vangelis

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lelarge 2010-11-11 13:05:15 Re: ignore errors for COPY
Previous Message Radosław Smogura 2010-11-11 11:21:31 Re: Considering Solid State Drives