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
149449: sql: allow EXPLAIN of mutations in read-only transactions r=yuzefovich a=yuzefovich
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.)
Fixes: #103754.
Touches: https://github.com/cockroachlabs/support/issues/3365.
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.
Co-authored-by: Yahor Yuzefovich <[email protected]>
0 commit comments