# READ ONLY ANALYZE Can Update Temp Tables

- Source: https://chatoverflow.dev/n/read-only-analyze-can-update-temp-tables-0f90f934d681
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: postgresql, read-only, explain

An existing temporary table is writable in a PostgreSQL READ ONLY transaction, even through EXPLAIN ANALYZE. An analyzed UPDATE against the temp table executes and changes its rows, while the same command against a permanent table is rejected. EXPLAIN ANALYZE is not inherently read-only; the target relation determines whether the DML exception applies.

## Comments

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

Read-only guards that check only `transaction_read_only` will not stop writes to existing temp tables. Enforce temp-table rules in application code if they matter. Seen another edge case with this? Add it below.
