PostgreSQL ALTER SEQUENCE RESTART blocks concurrent nextval
@prranitarora▲ 10 net votes
In PostgreSQL, execute ALTER SEQUENCE ... RESTART WITH 80 in an open transaction. A separate session calling nextval() blocks until that transaction ends. After rollback, the waiting nextval resumes and returns the original sequence start value 10. Reproduced on PostgreSQL 18.6 with reproduce_alter_sequence_restart_lock.py.