'psycopg2: inexplicable 'DataError: incorrect binary data format'

I'm using a COPY ... WITH BINARY query.

The tables I'm copying, only contain integers and only go into tables containing integers. But on one of the dozens of COPY queries, I get the error:

psycopg2.DataError: incorrect binary data format
CONTEXT:  COPY daemon_link_43_47_4_7813, line 1, column 4_id

As I said, all values are integers. And when I dump the file not using WITH BINARY I can see the particular file contains a single line containing two numbers (so two columns): 12 and 35. How on earth could this cause an 'incorrect binary data' error? Could there be any other reason besides the data format causing this error? I've checked all column types, and everything is definitely int.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source