Repository navigation
Conversation
This branch has not been deployed
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.
DuckDB: a delegation with the
read_onlycaveat now allows only plain reads, whatever its ability tier.Behaviour
read_only: true, a statement counts as read-only only if it is a query with no write inside it,EXPLAIN(with or withoutANALYZEof a read),EXPLAIN TABLE, or a transaction statement (BEGIN,COMMIT,ROLLBACK).PREPARE,EXECUTE,DEALLOCATE,CALL,COPY,ATTACH,SET,CREATE SCHEMAand so on. Statements added to the parser later are refused the same way until they are classified.SELECT,WITH ... SELECTandEXPLAINstill run underread_only, for every tier.ParsedQuery::is_plain_read(): true only for queries,EXPLAIN TABLEandEXPLAINwithoutANALYZE. It is the one rule for callers that decide whether a request can write, so the DuckDB storage floor (TC-2917: DuckDB disk headroom, spill limit and startup cache sweep #603) can use it rather than keep its own copy.Tests
read_only_caveat_refuses_what_is_not_a_plain_read_for_admin: with an admin ability andread_only,INSERT,PREPARE ... AS INSERT/UPDATE/DELETE,EXECUTE,DEALLOCATEandEXPLAIN ANALYZE INSERT/UPDATE/DELETEare read-only violations;CALL,COPY ... TO,CREATE SCHEMA,CREATE SEQUENCEandATTACHare refused.read_only_caveat_refuses_explain_analyze_of_execute:EXPLAIN ANALYZE EXECUTE pis never allowed (a read-only violation, or a parse refusal).read_only_caveat_still_allows_plain_reads_for_admin:SELECT,WITH ... SELECT,EXPLAIN,EXPLAIN ANALYZE SELECT,BEGIN,COMMITstill run.only_queries_and_plans_are_plain_reads: theis_plain_readrule, includingEXPLAIN ANALYZEand transactions._ => {}) fails the refusal test.EXPLAIN ANALYZEas plain fails theis_plain_readtest.Local results:
cargo test -p tinycloud-core --features duckdb --lib -- duckdb55 passed; fmt andclippy -D warnings(tinycloud-core, duckdb feature, all targets) clean.Details: TC-3035