Module side_effecting_func

Source
Expand description

Support for side-effecting functions.

In PostgreSQL, these functions can appear anywhere in a query:

SELECT 1 WHERE pg_cancel_backend(1234)

In Materialize, our compute layer cannot execute functions with side effects. So we sniff out the common form of calls to side-effecting functions, i.e. at the top level of a SELECT

SELECT side_effecting_function(...)

where all arguments are literals or bound parameters, and plan them specially as a Plan::SideEffectingFunc. This gets us compatibility with PostgreSQL for most real-world use cases, without causing stress for the compute layer (optimizer, dataflow execution, etc.), as we can apply all the side effects entirely in the adapter layer.

Structs§

SefCall 🔒
SideEffectingFuncImpl
Defines the implementation of a side-effecting function.

Enums§

SefKind
SideEffectingFunc
A side-effecting function is a function whose evaluation triggers side effects.

Constants§

PG_CANCEL_BACKEND 🔒

Statics§

PG_CATALOG_SEF_BUILTINS
A map of the side-effecting functions in the pg_catalog schema, keyed by OID.

Functions§

describe_select_if_side_effecting
Describes a SELECT if it contains calls to side-effecting functions.
extract_sef_call 🔒
Helper function used in both describing and planning a side-effecting SELECT.
plan_select_if_side_effecting
Plans the SELECT if it contains calls to side-effecting functions.