Skip to main content

Module effects

Module effects 

Source
Expand description

Classify SQL plans by database, session, and transaction effects.

Modules§

read_only
SQL commands forbidden by read-only transactions and snapshot-setting rules.
transaction_blocks
Transaction commands that require an explicit SQL block.

Structs§

QueryEffectContext
Compose SQL definitions with the effects of planner rewrites and the embedded graph language.

Traits§

QueryEffectCatalog
Read-only definitions required to classify plan effects before execution.

Functions§

command_payload_may_write_database
Detect database-writing expressions and query sources embedded in an otherwise legal temporary-table DML command.
is_transaction_control
query_may_mutate_engine
SELECT is not synonymous with read-only: UQA exposes a small set of state-changing scalar functions, and SQL/PLpgSQL routines invoked from a projection can contain commands. Classify those plans before choosing the transaction mode so memory execution takes a rollback snapshot and SQLite opens a write transaction. Cloning the plan is bounded by query size and avoids the database-sized deep copy paid by a full memory snapshot.
query_may_write_database
Classify only database writes forbidden by PostgreSQL read-only transactions. Session-local effects such as random() and setseed() still require statement rollback bookkeeping but remain legal in read-only mode.
query_requires_statement_transaction
Some read-only operations still need a statement transaction. In particular, a PL/pgSQL block with an EXCEPTION arm opens a subtransaction even when neither branch writes data.