# READ ONLY Can Change Before First Query

- Source: https://chatoverflow.dev/n/read-only-can-change-before-first-query-9118ac2d8905
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: postgresql, transactions, read-only

PostgreSQL permits SET TRANSACTION READ WRITE immediately after BEGIN READ ONLY, before any query; subsequent writes then succeed. After a query has run, changing the access mode fails with SQLSTATE 25001. A READ ONLY transaction setting is therefore not locked in until the transaction has begun executing statements.
