Expand description
SQL function volatility and expression rewrite safety over catalog metadata.
Volatility is a semantic property, not merely an optimizer hint. A
VOLATILE call may not be duplicated, elided, moved to a different join
level, or hidden behind a statement-local view cache. Keep the decision in
one place so the view, CTE, predicate-pushdown, column-pruning, and DPccp
paths cannot drift apart.
Traits§
- Volatility
Catalog - Metadata needed to classify SQL expressions without invoking a routine or reading a row.
Functions§
- builtin_
function_ volatility - Classify an already selected built-in without consulting host or SQL routine registrations. Callers that have not resolved the routine must use the catalog-aware entry point instead.
- expr_
contains_ volatile_ function - expression_
plan_ contains_ volatile_ function - Inspect a scalar plan with its query arena instead of treating every subquery as an opaque volatile call.
- function_
binding_ is_ volatile - function_
volatility - Resolve the volatility of the implementation that can run for
name. - function_
volatility_ with_ binding - query_
contains_ volatile_ function - Inspect a complete query, including transitive view dependencies.
- scalar_
calls_ are_ volatile - Inspect calls in this scalar expression only. The caller must inspect query-valued children through their owning arena before moving or duplicating an expression.
- scalar_
in_ scope_ contains_ volatile_ function - Inspect an expression’s referenced subqueries under its enclosing CTE namespace. Those external producers are owned and evaluated by their defining query, not by this scalar expression.
- scalar_
with_ subqueries_ contains_ volatile_ function - Inspect a borrowed expression and only the query children it references in its owning arena. Other projections may share that arena without contributing effects to this expression.
- select_
contains_ volatile_ function - The block’s own subquery plans are inspected separately by the query-level walk, so subquery references here are not conservatively volatile.
- unified_
plan_ contains_ volatile_ function - Whether scalar optimizer rewrites or
DPccpjoin enumeration must preserve volatile call scheduling. Borrow the plan and its expression roots; inspecting constants must not copy their retained payloads or allocate command child lists.