Skip to content

Instantly share code, notes, and snippets.

View eef's full-sized avatar
💭
I may be slow to respond.

Arthur Canal eef

💭
I may be slow to respond.
  • DoStuffMedia
  • Austin, Texas
View GitHub Profile
@eef
eef / postgresql-set-id-seq.sql
Created October 11, 2021 21:54 — forked from henriquemenezes/postgresql-set-id-seq.sql
PostgreSQL set Next ID Sequence Value to MAX(id) from Table
-- Get Max ID from table
SELECT MAX(id) FROM table;
-- Get Next ID from table
SELECT nextval('table_id_seq');
-- Set Next ID Value to MAX ID
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));