Skip to content

PostgreSQL

Starting a sequence at MAX(column) + 1

SELECT SETVAL('public."table_Id_seq"', COALESCE(MAX("Id"), 1)) FROM public."table";