Last active
January 3, 2016 20:29
-
-
Save danieljohnmorris/8515138 to your computer and use it in GitHub Desktop.
postgres - duplicate key violates unique constraint postgresql (i get this error when downloading production rails db to localhost through heroku)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in psql prompt | |
# connect to db | |
\c databasename | |
# update counter | |
SELECT setval('tablename_columnname_seq', (SELECT MAX(columnname) FROM tablename)+1); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment