Aaron Harker
Aaron Harker

Reputation: 321

pgadmin - ERROR: invalid input syntax for type bigint

I'm trying to import a CSV file via pgadmin dn it keeps throwing an error on the first line

ERROR:  invalid input syntax for type bigint: "8668394"

I recognize the "" say it is is trying to import the integer as a string but I can't understand why this is the case. When I open the CSV in notepad++ it doesn't show any quote marks or formating that might be causing this. This is what I see in notepad++

8668394,Damoujia,China,Asia/Shanghai,36.54356,119.81326 CR LF
9123882,Shanwang,China,Asia/Shanghai,36.5454,118.711 CR LF
11969451,Katang Ailieke,China,Asia/Urumqi,38.15279,85.51784 CR LF
12110889,Wulong,China,Asia/Shanghai,29.32431,107.76056 CR LF
12324243,Yingqiu,China,Asia/Shanghai,36.52663,118.99285 CR LF

Does anyone have any idea what is going wrong here?

Upvotes: 1

Views: 25691

Answers (1)

Aaron Harker
Aaron Harker

Reputation: 321

For anyone else facing a similar issue. My problem was that the file was encoded using UTF8-BOM, in notepad++ select Encoding > UTF-8 and resave your file. This will remove the hidden Byte Order Mark(BOM) at the start of the file and allow the import to work correctly.

Upvotes: 2

Related Questions