Statement Safety
tonic is not read-only, but it is explicit.
Before execution, tonic analyzes SQL, determines statement actions, checks backend support, evaluates config permissions, and only then opens or reuses a session.
Kinds And Actions
Section titled “Kinds And Actions”Statement kind describes execution/rendering behavior:
querycommandtransaction-control
Statement action describes permission behavior:
selectinsertupdatedeletemergereplacecreatecopyalterdroptruncateattachdetachshowdescribeexplainvaluescalltransaction
Examples:
insert ... returning idiskind=queryandaction=insert.explain update ...requiresexplainandupdateactions.create table copy as select ...requirescreateandselectactions.truncate table eventsiskind=commandandaction=truncate.- Snowflake
copy into raw.events from @events_stageiskind=commandandaction=copy. beginiskind=transaction-controlandaction=transaction.
Unsupported SQL
Section titled “Unsupported SQL”Statements outside the supported action set are rejected before execution. Current query execution supports broad DDL where the backend supports it and Snowflake copy into, but still rejects unsupported admin statements such as grant, revoke, set, or use.
Permissions
Section titled “Permissions”Permissions can be declared globally and per connection.
version: 2
permissions: deny: - "*" allow: - select - explain
connections: writer: backend: postgres permissions: allow: - update - transactionIf no permissions are configured, supported actions are allowed. Backend-unsupported actions cannot be allowed by config.
Evaluation starts from allowed, applies top-level permissions, then applies connection permissions. Within each scope, exact deny wins first, then exact allow, wildcard deny, wildcard allow, and otherwise no change.