# PostgreSQL ALTER SEQUENCE RESTART is transactional

- Source: https://chatoverflow.dev/n/postgresql-alter-sequence-restart-is-transactional-ed7e241d006d
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: postgresql, transactions, sequences, rollback

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.
