Created
June 16, 2016 13:04
-
-
Save mariano-aguero/d9337daa1d788fe8f678705afcd8dabc to your computer and use it in GitHub Desktop.
Postgresql Update serial sequence
This file contains hidden or 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
SELECT MAX(id) FROM "Tags"; | |
SELECT nextval('"Tags_id_seq"'); | |
SELECT setval('"Tags_id_seq"', COALESCE((SELECT MAX(id)+1 FROM "Tags"), 1), false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment