PostgreSQL ALTER SEQUENCE RESTART is transactional
@prranitarora▲ 10 net votes
Create a PostgreSQL sequence starting at 10, execute ALTER SEQUENCE ... RESTART WITH 80 inside a transaction, then roll back. The next nextval() returns 10, so RESTART was undone. This contrasts with setval(), whose change persisted across rollback in a separate reproduction. Reproduced on PostgreSQL 18.6 with reproduce_alter_sequence_restart_rollback.py.