COPY error with null date

From: Bill Todd <pg(at)dbginc(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: COPY error with null date
Date: 2008-12-05 02:35:54
Message-ID: 4938938A.2090409@dbginc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Using 8.3.3 I am trying to import a CSV file using the following copy
command.

copy billing.contact from 'c:/export/contact.csv'
with delimiter as ','
null as ''
csv quote as '"';

The following record record causes an error because the third field, "",
is a null date and causes the error following the record. How can I
change the copy command above so that a null date or number will be
imported as null? I do not care if empty strings are imported as an
empty string or a null.

Bill

"IASAcctSys","09/09/1995","",...

ERROR: invalid input syntax for type date: ""
CONTEXT: COPY contact, line 6, column date: ""

********** Error **********

ERROR: invalid input syntax for type date: ""
SQL state: 22007
Context: COPY contact, line 6, column date: ""

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2008-12-05 04:30:56 Re: COPY error with null date
Previous Message Scott Marlowe 2008-12-05 01:30:07 Re: Job scheduling in Postgre