Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lots of PG::UniqueViolation: "duplicate key value violates unique constraint" errors #44

Closed
bteitelb opened this issue Nov 26, 2014 · 3 comments
Labels

Comments

@bteitelb
Copy link
Collaborator

I see lots of exceptions like this for: activities, users, workshops, and possibly other tables. What's going on?

@bteitelb bteitelb added the bug label Nov 26, 2014
@bteitelb
Copy link
Collaborator Author

I deployed the potential fix to #43. If that works, we'll have more informative exceptions which could shed some light on why we are violating Postgres's constraints.

@bteitelb
Copy link
Collaborator Author

It looks like all of the failures are on the primary keys. So, we may need to reset Postgres's primary key sequences, as described here: http://stackoverflow.com/questions/244243/how-to-reset-postgres-primary-key-sequence-when-it-falls-out-of-sync

@antmachine
Copy link
Collaborator

Reset the keys. I set the nextval to be 1 higher than current maxval on all of the tables where the primary key was out of sync. Not sure how that happened...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants