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:
selectinsertupdatedeletemergereplaceshowdescribeexplainvaluescalltransaction
Examples:
insert ... returning idiskind=queryandaction=insert.explain update ...requiresexplainandupdateactions.beginiskind=transaction-controlandaction=transaction.
Unsupported SQL
Section titled “Unsupported SQL”Statements outside the supported action set are rejected before execution. Current query execution does not run arbitrary DDL or admin statements such as create, alter, drop, truncate, grant, revoke, set, use, or copy into.
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.