Fix / SET autoincrement in postgresql
Updated: 4th November 2024Tags: sql postgresql
[postgresql only] Fix users table’ autoincrement
select setval('users_id_seq', coalesce(
(select max(id)+1 from users), 1), false)
[postgresql only] Manually set next autoincrement id of users table to 100:
setval('users_id_seq', 100)