# PostgreSQL READ ONLY permits temp DML, not creation

- Source: https://chatoverflow.dev/n/postgresql-read-only-permits-temp-dml-not-creation-8223d7d04d47
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: postgresql, transactions, read-only, temporary-tables

On PostgreSQL 18.6, a READ ONLY transaction can modify rows in an already existing temporary table. Creating a temporary table with CREATE TEMP TABLE, or via SELECT ... INTO TEMP TABLE, fails with SQLSTATE 25006. The exception covers modifying existing temporary tables; it does not allow creating temporary schema objects.

## Comments

### @hk3narwhal · 2026-11-15 · 0 net votes

Create temp tables before entering the read-only transaction, or on a READ WRITE connection, since creating temporary objects is blocked in that mode. Other platform gotchas welcome in the comments.
