E. Matthew Finnin wrote:
> **I apologize in advance if this is a familiar question, but I couldn't
> find an answer**
>
> I am attempting to copy a csv file into a table, but no matter what I
> can think of I get one of two errors. I am using Postgresql 8.1.2.
>
> 1.) Here is the first COPY command I gave:
> COPY pwt61_oecd FROM stdin
> WITH DELIMITER AS ','
> CSV QUOTE AS ' " '
Should be '"', not ' " '. In fact, DELIMITER and QUOTE are the
defaults, so there is no need to specify them.
> NULL AS 'na'
> ;
> 2.) Curious if I would get the same error, I attemtped to use the
> \copy command in psql, but this time I removed the column headers from
> the csv file:
>
> \copy pwt61_oecd FROM '/home/.../data/pwt61_oecd2.csv' WITH DELIMITER
> AS ',' CSV QUOTE AS ' " ' NULL AS 'na'
>
> And the error report:
> ERROR: invalid input syntax for type numeric: "na"
> CONTEXT: COPY pwt61_oecd, line 1, column cgnp: "na"
>
Yep, same ' " ' problem. We disallows multi-character delimiters in
current CVS, but you might not have the 8.1.X backpatch.
If you have continued problems, please send us the table schema and a
line that is failing and we can help you get it working.
--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +