I need after TRUNCATE table, reset its sequence, for this I do:
SELECT setval('mytable_id_seq', 1)
After inserting rows into a table, the sequence begins with 2 not 1
How to save a sequence value such that the new first value will be 1 ?
SELECT setval('mytable_id_seq', 0) // gives error that value is out of range
Riki source share