PGSQL 9.3.2 COPY command issues

From: spake(at)surewest(dot)net
To: pgsql-novice(at)postgresql(dot)org
Subject: PGSQL 9.3.2 COPY command issues
Date: 2014-07-17 19:01:26
Message-ID: ae7a270f45be9b9d59c70d5d67bd78b8@surewest.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi there. My first post to this list. Hopefully, as time goes by, I will
be able to answer more questions than I ask.

I'm trying to import a very large CSV file of npi data into psql 9.3.2
using the COPY command. The data in the CSV file is surrounded by
quotes. Although there is a header, the data looks like this:
"1679576722","1","","","","WIEBE", etc.

Here is my psql command:
COPY data FROM '/Developer/data_20140608.csv' DELIMITER ',' CSV HEADER;

and here is the error I get:
ERROR: invalid input syntax for type numeric: ""
CONTEXT: COPY npi_data, line 2, column replacement_npi: ""

psql seems to be choking on the empty fields that are quoted. Any
suggestions as to how I get around this? I've tried including the QUOTES
statement but it made no difference.

Thanks,

Kevin

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Albe Laurenz 2014-07-18 09:09:02 Re: PGSQL 9.3.2 COPY command issues
Previous Message David G Johnston 2014-07-11 14:27:13 Re: user aggregate with exception handling