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?

2

1 Answer

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article
Twitter Facebook Pinterest