reset table id sequence

/ Published in: SQL
Save to your folder(s)

reset id sequence from postgres table

Copy this code and paste it in your HTML
  1. WITH mx AS ( SELECT MAX(id) AS id FROM sch.mytable)
  2. SELECT SETVAL('sch.mytable_id_seq', AS curseq
  3. FROM mx;

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.