Discussion:
[ADMIN] Trouble w/ COPY command
(too old to reply)
Wells Oliver
2012-04-14 22:45:47 UTC
Permalink
I have CSV files blowing up because they have double quotes around numeric
values: " 1.34" yields ERROR: invalid input syntax for type numeric: "
1.34"

And occasionally these are empty, and you see invalid syntax for type
numeric: " "

Are there flags I can pass to COPY to avoid this? There are properly quoted
string values elsewhere in the final, so I'm reticent to strip out double
quote characters or anything.

Thank you.
--
Wells Oliver
***@gmail.com
Tom Lane
2012-04-15 00:01:02 UTC
Permalink
Post by Wells Oliver
I have CSV files blowing up because they have double quotes around numeric
values: " 1.34" yields ERROR: invalid input syntax for type numeric: "
1.34"
Is that an exact copy of the error message? Because there are double
quotes in that error message's text; what you are showing does not
suggest that they are part of the data value. I'm wondering about
non-visible characters myself.
Post by Wells Oliver
And occasionally these are empty, and you see invalid syntax for type
numeric: " "
Well, that you're going to have to do something else about. Possibly
you could treat the empty string as null? (See the 'null string'
option to COPY.)

regards, tom lane
--
Sent via pgsql-admin mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Loading...