PostgreSQL: Handling the sequence value in psql(Reset sequence/ Get sequence next value)
PostgreSQL: Reset the sequence value of the table
Example1
select setval('students_id_seq',1706);Result
  setval 
--------
   1706
(1 row)
===============================
Example2(Recommanded)
To reset the sequence exactly to the recent primarykey id. This is the best idea to reset the sequence by avoiding usual conflicts.
select setval('students_id_seq',(select max(id) from students)) 
