PGSQL 9.3.2 COPY command issues - Mailing list pgsql-novice

From spake@surewest.net
Subject PGSQL 9.3.2 COPY command issues
Date
Msg-id ae7a270f45be9b9d59c70d5d67bd78b8@surewest.net
Whole thread Raw
Responses Re: PGSQL 9.3.2 COPY command issues  (Albe Laurenz <laurenz.albe@wien.gv.at>)
Re: PGSQL 9.3.2 COPY command issues  (Vinayak Pokale <vinpokale@gmail.com>)
Re: PGSQL 9.3.2 COPY command issues  (David G Johnston <david.g.johnston@gmail.com>)
List 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

 

 

pgsql-novice by date:

Previous
From: David G Johnston
Date:
Subject: Re: user aggregate with exception handling
Next
From: Albe Laurenz
Date:
Subject: Re: PGSQL 9.3.2 COPY command issues