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', mx.id) AS curseq
  3. FROM mx;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.