Skip to content

Instantly share code, notes, and snippets.

@takakd
Created March 10, 2020 12:50
Show Gist options
  • Save takakd/736d32ba0e1f5241032a4c9495bac512 to your computer and use it in GitHub Desktop.
Save takakd/736d32ba0e1f5241032a4c9495bac512 to your computer and use it in GitHub Desktop.
Update sequence by last_value in PostgreSQL
-- update sequence by last_value
SELECT setval('some_table_seq', (SELECT last_value FROM some_table_seq)+1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment