1
Resetting a sequence
Source: supabase/supabase#46296 · opened by @Vinaysohaliya
A sequence is a database object that generates a series of unique integers. Sequences are most commonly used to produce primary key values automatically (e.g. the id column on a table).
When you create a column with type serial, bigserial, or use generated always as identity, Postgres automatically creates and manages a sequence for that column. These sequences appear on the Sequences page and can be reset the same way.
Using a sequence
Use nextval() to get the next value from a sequence:
Use currval() to get the current value without advancing it:
What it will do -----> Enter the next value you want the sequence to use (e.g. if your data has IDs up to 999, enter 1000).
example -
<img width="371" height="197" alt="Screenshot 2026-05-23 at 7 37 32 PM" src=" />
<img width="382" height="345" alt="Screenshot 2026-05-23 at 7 37 59 PM" src=" />
When you create a column with type serial, bigserial, or use generated always as identity, Postgres automatically creates and manages a sequence for that column. These sequences appear on the Sequences page and can be reset the same way.
Using a sequence
Use nextval() to get the next value from a sequence:
Use currval() to get the current value without advancing it:
What it will do -----> Enter the next value you want the sequence to use (e.g. if your data has IDs up to 999, enter 1000).
example -
<img width="371" height="197" alt="Screenshot 2026-05-23 at 7 37 32 PM" src=" />
<img width="382" height="345" alt="Screenshot 2026-05-23 at 7 37 59 PM" src=" />
No pledges yet. Be the first to back this.
No comments yet.