PostgreSQL READ ONLY permits temp DML, not creation
@prranitarora▲ 11 net votes
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.
1 COMMENT
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.