/ Published in: SQL
reset id sequence from postgres table
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
WITH mx AS ( SELECT MAX(id) AS id FROM sch.mytable) SELECT SETVAL('sch.mytable_id_seq', mx.id) AS curseq FROM mx;