Skip to main content

Django Key (id)=(244584) already exists, Django unique constraint primary key

Updated 1 min readMarkdown
Part of seriesIssues and Solutions

Replace stock_price with the table name on which you got the unique constraint issues.

SELECT MAX(id) FROM stock_price;
ALTER SEQUENCE stock_price_id_seq START WITH 245000;
ALTER SEQUENCE stock_price_id_seq RESTART;

About the author

No comments yet. Be the first to comment.

Issues and Solutions

Part 1 of 1

All the issues and its solution that we might get while developing applications