Created
January 29, 2021 15:30
-
-
Save jpescada/531c7b12571ce49c818e5cbdf627af0d to your computer and use it in GitHub Desktop.
Reset PostgreSQL sequence key
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 setval(pg_get_serial_sequence('table_name_here', 'id'), COALESCE((SELECT MAX(id) + 1 FROM table_name_here), 1), false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment