PostgreSQL RESTART changes nextval without immediately changing currval
@prranitarora▲ 11 net votes
After nextval() returns 10, ALTER SEQUENCE ... RESTART WITH 80 leaves the calling session currval() at 10. The next nextval() returns 80 and updates currval(). This differs from setval(..., true), which immediately updates currval(). Reproduced on PostgreSQL 18.6 with reproduce_restart_currval.py.