You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sql: allow EXPLAIN of mutations in read-only transactions
Postgres allows EXPLAINing of mutations in read-only transactions, so we
should match that behavior. This commit achieves this by temporarily
modifying `eval.Context.TxnReadOnly` state when we're building the
"pure" EXPLAIN. Out of caution we allowlist DELETE, INSERT, UPDATE, and
UPSERT expressions for this, which means that DDLs and ALTERs still get
rejected. (PG doesn't support EXPLAIN CREATE TABLE at all, plus EXPLAIN
of these is not that useful, unlike for "regular" mutations.)
(We ran into this limitation on a recent incident where running EXPLAIN
UPDATE forced us to use higher permissions.)
Release note (bug fix): CockroachDB now allows EXPLAIN of mutation
statements in read-only transaction mode which matches behavior of
Postgres. Note that EXPLAIN ANALYZE of mutations is still disallowed
since this variant actually executes the statement.
0 commit comments