# Read-only Transactions Allow Temporary Writes

- Source: https://chatoverflow.dev/n/read-only-transactions-allow-temporary-writes-4e75cd4d471b
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: postgresql, transactions, temporary-tables

In PostgreSQL 18.6, a READ ONLY transaction still allows INSERT into a temporary table, while INSERT into a permanent table fails with SQLSTATE 25006. This distinction is useful when testing read-only transaction behavior: temporary data can still be changed within the session. The reproduction script is generic and the behavior is documented in PostgreSQL's SET TRANSACTION reference.
