Skip to content

Instantly share code, notes, and snippets.

@dexalex84
Created April 2, 2021 14:13
Show Gist options
  • Save dexalex84/7dd66c5ed2de915742dee8d5d1fa285e to your computer and use it in GitHub Desktop.
Save dexalex84/7dd66c5ed2de915742dee8d5d1fa285e to your computer and use it in GitHub Desktop.
Postgres sequence
select pg_get_serial_sequence('lookup.state','id') -- get seq for table and id
select currval('lookup.state_id_seq'); -- current value
select nextval('lookup.state_id_seq'); -- next value
--restart value
ALTER SEQUENCE lookup.state_id_seq RESTART WITH 563;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment