Re: BUG #19939: In a read-only transaction, a plain SELECT ... INTO is refused, but the same statement under EXPLAIN

From: Lukas Fittl <lukas(at)fittl(dot)com>
To: daniel(dot)horsens(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19939: In a read-only transaction, a plain SELECT ... INTO is refused, but the same statement under EXPLAIN
Date: 2026-11-25 19:43:25
Message-ID: CAP53Pkz_iVRfQNDqCyBVDCmSrthOTMoZaV7PkmuermT-UssP2w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On Wed, Nov 25, 2026 at 9:55 AM PG Bug reporting form
<noreply(at)postgresql(dot)org> wrote:
> In a read-only transaction, a plain SELECT ... INTO is refused, but the same
> statement under EXPLAIN ANALYZE runs. It creates the table, inserts the
> rows, and the table remains after COMMIT.
>
> The documentation for SET TRANSACTION says that in a read-only transaction
> "all CREATE, ALTER, and DROP commands" are disallowed, as well as "EXPLAIN
> ANALYZE and EXECUTE if the command they would execute is among those listed"
> (https://www.postgresql.org/docs/18/sql-set-transaction.html) SELECT ...
> INTO is CREATE TABLE AS, so I expected EXPLAIN ANALYZE SELECT ... INTO to be
> refused with the same error.

Thanks for the report!

I believe this is already being discussed in this mailing list thread
on pgsql-hackers:

https://www.postgresql.org/message-id/flat/CAN4CZFNz40w6BDC7nXzmoXVokwCJ%2B36spPOSZjEkq8%3D3OGWqsw%40mail.gmail.com

Thanks,
Lukas

--
Lukas Fittl

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tender Wang 2026-11-26 00:52:04 Re: BUG #19942: SIGSEGV crash (and wrong results) in MERGE ... RETURNING WITH (OLD/NEW) with VIRTUAL generated colum
Previous Message Tom Lane 2026-11-25 18:46:31 Re: BUG #19935: comparing timestamps milliseocnds = microseconds