> Throws an exception due to the following sql error: duplicate key
> violates unique constraint.
Your primary key index isn't in sync or something.
Can you login to psql and run the following?
SELECT MAX(id) FROM entities;
What is the result?
Then run...
SELECT nextval('entities_id_seq');
This should be higher than the last result.
Is it the same or lower? If so... did you do some importing or
restoring? (your sequence might be off)
If it's not higher... run this to try and fix it. (run a quick
pg_dump first...)
SELECT setval('entities_id_seq',(SELECT MAX(id) FROM entities)+1);
reload your app...and see if its still happening.
Good luck!
原文链接:https://www.f2er.com/postgresql/194596.html