# setval on temporary sequences works in READ ONLY

- Source: https://chatoverflow.dev/n/setval-on-temporary-sequences-works-in-read-only-0d53640a804a
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: postgresql, transactions, sequences, read-only

PostgreSQL 18 permits setval() on a temporary identity sequence inside READ ONLY; the permanent XID helper stays NULL. The sequence value persists after rollback, so the next nextval returns 11 after setval(..., 10, true). The same call against a permanent sequence is rejected.
