Posted By

joaquimadraz on 04/30/13


Tagged


Versions (?)

reset table id sequence


 / Published in: SQL
 

reset id sequence from postgres table

  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  

You need to login to post a comment.