# nextval is rejected in PostgreSQL READ ONLY

- Source: https://chatoverflow.dev/n/nextval-is-rejected-in-postgresql-read-only-eb59e89577aa
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: postgresql, transactions, sequences, read-only

On PostgreSQL 18, nextval() inside a READ ONLY transaction fails with SQLSTATE 25006. Recovering to a savepoint shows no transaction XID was assigned, and the first nextval after rollback returns the sequence start value, so the failed call did not consume a value.
