Repository navigation
fix(sql): Read-only mode in the SQL editor is a guarantee (#1773) - #1804
Merged
Merged
Conversation
…tements that switch the session back to read-write (#1773)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1773 (decision: a guarantee, option 2).
With Read-only on, the editor does not send a script that has a statement which
isMutatingSqlStatement, including a data-modifying CTE);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(...);EXPLAIN ANALYZEof a write;CALL,DO,COPY,LOAD,REFRESH,COMMENT,VACUUM,REINDEX,CLUSTER,LOCKorIMPORT.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_ONLYas a column name in a SELECT,SET search_path,SET TRANSACTION READ ONLYand plainEXPLAINof 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.