Обсуждение: Copy can't parse a float?
I'm trying to copy into a table from a file, and postgres is complaining about a float value.... The table is as follows:
smallint,
smallint,
int,
smallint,
smallint,
integer,
float8
And the data file looks like:
2|11|30540|1|2||1.0
2|12|30540|1|1||0.0
2|13|30540|1|1||1.0
2|14|30540|1|1||1.0
2|15|30540|1|1||0.0
Here's my copy command:
echo "copy fact from '/data1/fact_oriZ01_2004.dat' with delimiter as '|' null as ''" | psql -d oridb
And it's dying on the first line with this error:
ERROR: copy: line 1, pg_atoi: error in "1.0": can't parse ".0"
Why can't it parse .0 in a float8?
On Fri, Feb 18, 2005 at 10:05:09AM -0500, Dan Quaroni wrote: > ERROR: copy: line 1, pg_atoi: error in "1.0": can't parse ".0" > > Why can't it parse .0 in a float8? It's not trying to parse a float8 -- it's trying to parse an integer (pg_atoi), so I'd guess that the table has another column that you're not considering. I'll also guess that you're using PostgreSQL 7.3.x, since later versions print more context: psql:foo.sql:16: ERROR: invalid input syntax for integer: "1.0" CONTEXT: COPY foo, line 1, column f6: "1.0" -- Michael Fuhr http://www.fuhr.org/~mfuhr/