<p>"DataError: integer out of range" in psycopg may be caused when you have a table with an integer auto-incrementing id and you insert more than 2^31-1 records. Note that if you TRUNCATE the table, the id sequence DOES NOT reset. Use <code>ALTER SEQUENCE sequence-name RESTART WITH 1;</code> for that. Find out the sequence name with <code>\d+ table_name</code>.</p>
By clicking “Accept all”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage and assist in our marketing efforts. Check our privacy policies.