Skip to main content

register_admin_function

Function register_admin_function 

Source
pub fn register_admin_function(
    func: impl Into<ScalarFunctionFactory>,
) -> FunctionRegistrationResult
Expand description

Register a function that is only available to the ADMIN statement executor.

If a function with the same name is already registered in the ADMIN registry, the existing one is kept and FunctionRegistrationResult::AlreadyExists is returned. A name that already exists in the normal FUNCTION_REGISTRY when this call linearizes is also rejected: the ADMIN executor resolves admin-only functions before falling back to the normal registry, so inserting such a name here would shadow the built-in. Otherwise the function is registered and FunctionRegistrationResult::Registered is returned.

The enforced contract is one-way: it only guards the ADMIN registration against names already present in the normal registry. A later ordinary FunctionRegistry::register may still install the same name in the normal registry because the normal registry keeps its legacy replace semantics.