pub struct FunctionFlags {
pub direct_only: bool,
pub innocuous: bool,
pub deterministic: bool,
}Expand description
What a registered function promises about itself.
It lives here, below inillucent-ext, because two different layers have to
read the same promise: inillucent_ext::registry::Registry records it when
an application registers a function, and the binder enforces it when a
schema names one. inillucent-ext re-exports this type, so a registrant
writes inillucent_ext::registry::FunctionFlags exactly as before.
Fields§
§direct_only: boolThe function may only be called from top-level SQL, never from a
schema: not from a DEFAULT, a CHECK, a generated column, an index
expression, a partial-index predicate, a view or a trigger.
FunctionFlags::external sets this, because the safe assumption about
code somebody else wrote is that it does something. It is not what the
Default derive gives, which is every flag false: a registrant who
writes ..FunctionFlags::default() gets a function a schema may name.
That is the hole embed was registered through (task-1969, 7.4), and
inillucent_ext::registry::UserFunction::external is the constructor to
reach for instead.
innocuous: boolThe function does nothing an ordinary expression could not: no side effects, no file access, no dependence on anything but its arguments.
deterministic: boolThe function returns the same answer for the same arguments within one statement, so the planner may call it once.
Implementations§
Source§impl FunctionFlags
impl FunctionFlags
Sourcepub fn builtin() -> FunctionFlags
pub fn builtin() -> FunctionFlags
Returns the flags a built-in carries: safe for a schema to call.
Sourcepub fn external() -> FunctionFlags
pub fn external() -> FunctionFlags
Returns the flags anything registered from outside carries by default.