Skip to content

Instantly share code, notes, and snippets.

@mariano-aguero
Created June 16, 2016 13:04
Show Gist options
  • Save mariano-aguero/d9337daa1d788fe8f678705afcd8dabc to your computer and use it in GitHub Desktop.
Save mariano-aguero/d9337daa1d788fe8f678705afcd8dabc to your computer and use it in GitHub Desktop.
Postgresql Update serial sequence
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