Skip to content

fix(sql): Read-only mode in the SQL editor is a guarantee (#1773) - #1804

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
fix/readonly-guarantee
Oct 25, 2026
Merged

ZhuchkaTriplesix merged 1 commit into
devfrom
fix/readonly-guarantee

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Closes #1773 (decision: a guarantee, option 2).

With Read-only on, the editor does not send a script that has a statement which

  • changes data or schema (isMutatingSqlStatement, including a data-modifying CTE);
  • switches the session out of read-only: SET ... transaction_read_only / default_transaction_read_only / tx_read_only / read_only, BEGIN | START TRANSACTION ... READ WRITE, SET [SESSION] TRANSACTION READ WRITE, SET SESSION CHARACTERISTICS ... READ WRITE, set_config(...);
  • is EXPLAIN ANALYZE of a write;
  • is CALL, DO, COPY, LOAD, REFRESH, COMMENT, VACUUM, REINDEX, CLUSTER, LOCK or IMPORT.

The result is a message in the tab (Read-only mode is on and <why>. Turn Read-only off to run it.), nothing reaches the server. READ_ONLY as a column name in a SELECT, SET search_path, SET TRANSACTION READ ONLY and plain EXPLAIN of a write still run.

Not done from the issue: resetting the pool slot's setting when it is taken. The read-only slots are keyed apart from the read-write ones, and the only way the app could switch one to writable was a script from the editor, which this check stops; re-sending the setting on every acquire would cost a round trip for the tree and table views too. Not run locally, CI will.

…tements that switch the session back to read-write (#1773)
@github-actions github-actions Bot added question Further information is requested P3 Low priority / Polish & Enhancements labels Oct 25, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 484ee9e into dev Oct 25, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low priority / Polish & Enhancements question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant