Re: PGSQL 9.3.2 COPY command issues - Mailing list pgsql-novice

From David G Johnston
Subject Re: PGSQL 9.3.2 COPY command issues
Date
Msg-id 1405685707257-5811948.post@n5.nabble.com
Whole thread Raw
In response to PGSQL 9.3.2 COPY command issues  (spake@surewest.net)
List pgsql-novice
spake wrote
> 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: ""

Numeric columns in CSV are not quoted. What you have here is a text field in
the file and a numeric field in the database.  You must resolve the
mis-match.  The easiest way is to define the table column as text.  If you
ultimately need to convert the column into numeric then you should consider
the import table to be a staging table and after the copy is done you
migrate the copied in data to the production table while performing any data
transformations needed.

David J.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/PGSQL-9-3-2-COPY-command-issues-tp5811940p5811948.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.


pgsql-novice by date:

Previous
From: Vinayak Pokale
Date:
Subject: Re: PGSQL 9.3.2 COPY command issues
Next
From: John Neal
Date:
Subject: JBDC LDAP support