Lessons Learned

contact@vinta.com.br

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 ALTER SEQUENCE sequence-name RESTART WITH 1; for that. Find out the sequence name with \d+ table_name.

Did you like?
1