pub struct CreateFunction {Show 26 fields
pub object_id: Option<[u8; 16]>,
pub catalog_revision: Option<[u8; 16]>,
pub catalog_oid: Option<u32>,
pub name: String,
pub or_replace: bool,
pub is_procedure: bool,
pub params: Vec<FunctionParam>,
pub returns: FunctionReturns,
pub return_type_reference: Option<RoutineColumnTypeReference>,
pub return_written_type: Option<String>,
pub language: String,
pub body: FunctionBody,
pub sql_body_form: Option<SQLBodyForm>,
pub creation_search_path: Vec<String>,
pub volatility: FunctionVolatility,
pub strict: bool,
pub owner: Option<RoleIdentity>,
pub security: RoutineSecurityAttributes,
pub parallel: FunctionParallel,
pub support: Option<String>,
pub cost: Option<f32>,
pub rows: Option<f32>,
pub config: Vec<(String, String)>,
pub config_actions: Vec<RoutineConfigAction>,
pub attribute_clauses: RoutineAttributeClauses,
pub execute_acl: Option<Vec<RoutineAclEntry>>,
}Expand description
CREATE [OR REPLACE] FUNCTION | PROCEDURE.
Fields§
§object_id: Option<[u8; 16]>Stable catalog identity. The engine assigns this once when the routine is created and preserves it across replacement and rename.
catalog_revision: Option<[u8; 16]>The catalog tuple’s replacement identity. A replacement changes this token while keeping object_id; older definitions use their object identity until first replacement.
catalog_oid: Option<u32>The public OID allocated when the routine was created; replacement and rename keep it. Routines created before OIDs were recorded derive it from their identity.
name: String§or_replace: bool§is_procedure: bool§params: Vec<FunctionParam>§returns: FunctionReturns§return_type_reference: Option<RoutineColumnTypeReference>Parsed %TYPE identity for a scalar or set return declaration until registration resolves it.
return_written_type: Option<String>The declared result type as the statement wrote it, without SETOF, until registration resolves it.
language: StringLower-cased language name (plpgsql, sql).
body: FunctionBody§sql_body_form: Option<SQLBodyForm>The written form of a SQL-standard body. Definitions stored before the form was recorded omit it.
creation_search_path: Vec<String>Effective schema search path captured when a SQL-standard body or parameter default is catalog-bound. String and PL/pgSQL bodies keep dynamic lookup, but their parameter defaults still use this captured path.
volatility: FunctionVolatility§strict: boolSTRICT / RETURNS NULL ON NULL INPUT - the function is not
invoked when any input argument is NULL; the result is NULL.
owner: Option<RoleIdentity>Catalog owner incarnation. Parsed declarations and anonymous blocks are unbound; registration binds the effective current role before publication.
security: RoutineSecurityAttributesExecution identity and leakproofness, flattened to retain the catalog-definition wire shape.
parallel: FunctionParallelParallel-safety classification.
support: Option<String>Optional planner support routine identity.
cost: Option<f32>COST, the estimated execution cost in units of cpu_operator_cost that pg_proc.procost reports, a float4 as PostgreSQL stores it; without one the language’s default applies.
rows: Option<f32>ROWS, the estimated number of rows a set-returning routine returns, which pg_proc.prorows reports; without one the default applies.
config: Vec<(String, String)>Effective per-routine configuration as name=value pairs in declaration order.
config_actions: Vec<RoutineConfigAction>Creation-time configuration actions awaiting engine/session resolution. Registration consumes this list before persistence.
attribute_clauses: RoutineAttributeClausesThe statement’s attribute clauses in written order, which registration checks and consumes before persistence.
execute_acl: Option<Vec<RoutineAclEntry>>Explicit execution privileges, including the owner’s revocable EXECUTE. None means the PostgreSQL default (PUBLIC and owner EXECUTE); ownership always retains implicit grant options.
Implementations§
Source§impl CreateFunction
impl CreateFunction
Sourcepub fn identity_params(&self) -> Vec<&FunctionParam>
pub fn identity_params(&self) -> Vec<&FunctionParam>
Parameters that define routine identity: IN + INOUT + VARIADIC, in declaration order.
Sourcepub fn identity_arity(&self) -> usize
pub fn identity_arity(&self) -> usize
Number of parameters that define routine identity.
Sourcepub fn call_params(&self) -> Vec<&FunctionParam>
pub fn call_params(&self) -> Vec<&FunctionParam>
Parameters supplied by a call: identity parameters for functions and every non-TABLE parameter for procedures.
Sourcepub fn call_arity(&self) -> usize
pub fn call_arity(&self) -> usize
Number of declared call parameters; a variadic parameter can consume multiple actual arguments.
Sourcepub fn required_call_arity(&self) -> usize
pub fn required_call_arity(&self) -> usize
Minimum number of actual arguments for ordinary expanded notation; a variadic parameter accepts zero elements.
Sourcepub fn sql_body_parameters(&self) -> Vec<SQLBodyParameter<'_>>
pub fn sql_body_parameters(&self) -> Vec<SQLBodyParameter<'_>>
The parameters a SQL-standard body refers to, as interpret_AS_clause gives them to its parser: the input parameters in order, the one at position n going by the name of the parameter declared at position n among all parameters. When an output parameter precedes an input, the body therefore names that input by the output parameter’s name, as PostgreSQL does.
Sourcepub fn signature_arity(&self) -> usize
pub fn signature_arity(&self) -> usize
Backward-compatible alias for Self::call_arity.
Sourcepub fn required_arity(&self) -> usize
pub fn required_arity(&self) -> usize
Backward-compatible alias for Self::required_call_arity.
Sourcepub fn signature_params(&self) -> Vec<&FunctionParam>
pub fn signature_params(&self) -> Vec<&FunctionParam>
Backward-compatible alias for Self::call_params.
Sourcepub fn output_params(&self) -> Vec<&FunctionParam>
pub fn output_params(&self) -> Vec<&FunctionParam>
Parameters that shape the result row: OUT + INOUT +
RETURNS TABLE columns, in declaration order.
Sourcepub fn returns_set(&self) -> bool
pub fn returns_set(&self) -> bool
True when the routine produces a row set (RETURNS SETOF /
RETURNS TABLE).
Trait Implementations§
Source§impl Clone for CreateFunction
impl Clone for CreateFunction
Source§impl Debug for CreateFunction
impl Debug for CreateFunction
Source§impl<'de> Deserialize<'de> for CreateFunction
impl<'de> Deserialize<'de> for CreateFunction
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for CreateFunction
impl RefUnwindSafe for CreateFunction
impl Send for CreateFunction
impl Sync for CreateFunction
impl Unpin for CreateFunction
impl UnsafeUnpin for CreateFunction
impl UnwindSafe for CreateFunction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more