Skip to content
Advertisement

Why am I getting “Invalid input syntax for type integer” in postgresql when importing a CSV?

I’m trying to import a .csv file to my postgresql DB. I created a table as follows:

Then I used the following command to import the .csv file

And my .csv file contains the following:

However, this doesn’t work and the following message appear:

Advertisement

Answer

Maybe there is a BOM in the CSV?

  • hexdump the file, and inspect the first three characters
  • (and) use an editor to remove the BOM
  • (or) export again, without the BOM (there should be a checkmark, even in the Microsoft “software”)
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement