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§
- expr_
contains_ volatile_ function - 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.
- 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 be kept away from a plan.rewrite_scalar_expressionsis exhaustive over query, mutation, CTE, prepared/explained, and expression-plan children.