dimitri / pgloader

Migrate to PostgreSQL in a single command!
http://pgloader.io
Other
5.45k stars 548 forks source link

Database error 22P02 invalid input syntax for type integer: "1.0" #1467

Open EmeOteros opened 1 year ago

EmeOteros commented 1 year ago

Hi, I'm trying to load a csv file to a ddbb, but I get the following error:

"Database error 22P02 invalid input syntax for type integer: "1.0""

I'm using the pgloader version "3.6.999791d". LOAD CSV FROM '/home/received_csvs/csv_load.csv' WITH ENCODING UTF-8 HAVING FIELDS ( id, longitude, latitude, time [date format 'YYYY-MM-DD'], pacode, variety, value, magma, mod, created ) INTO postgresql://postgres:pass@localhost:5432/ddbb_name TARGET TABLE csv_load TARGET COLUMNS ( longitude, latitude, time, pacode, variety, value, magma, mod, created ) WITH truncate, skip header = 1, fields optionally enclosed by '"', fields escaped by double-quote, fields terminated by ';'; The "value" field is the one that is giving me problems, the values there are: "1.0" or "0.0" I suposse that the solution would be to do a truncate, but I don't really know how to implement it. I tried value using (truncate), it also gave me errors of the type:

In context KW-USING: while parsing KW-USING. Expected: the character Tab or the character Newline ... or the string "using" and i tried value "using" (truncate), but it gives me the same error...