Skip to main content

CreateFunction

Struct CreateFunction 

Source
pub struct CreateFunction {
Show 27 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 body_origin: Option<RoutineBodyOrigin>, 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: String

Lower-cased language name (plpgsql, sql).

§body: FunctionBody§body_origin: Option<RoutineBodyOrigin>

Original client source mapping, cleared before catalog publication.

§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: bool

STRICT / 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: RoutineSecurityAttributes

Execution identity and leakproofness, flattened to retain the catalog-definition wire shape.

§parallel: FunctionParallel

Parallel-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: RoutineAttributeClauses

The 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

Source

pub fn source_body_error(&self, error: SQLError) -> SQLError

Transpose a SQL string body’s cursor into its defining request, or retain its internal source when no defining request is available. Other body forms retain their existing diagnostic.

Source§

impl CreateFunction

Source

pub fn identity_params( &self, ) -> impl DoubleEndedIterator<Item = &FunctionParam> + Clone

Parameters that define routine identity: IN + INOUT + VARIADIC, in declaration order.

Source

pub fn identity_arity(&self) -> usize

Number of parameters that define routine identity.

Source

pub fn call_params( &self, ) -> impl DoubleEndedIterator<Item = &FunctionParam> + Clone

Parameters supplied by a call: identity parameters for functions and every non-TABLE parameter for procedures.

Source

pub fn call_arity(&self) -> usize

Number of declared call parameters; a variadic parameter can consume multiple actual arguments.

Source

pub fn required_call_arity(&self) -> usize

Minimum number of actual arguments for ordinary expanded notation; a variadic parameter accepts zero elements.

Source

pub fn sql_body_parameters( &self, ) -> impl Iterator<Item = SQLBodyParameter<'_>> + Clone

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.

Source

pub fn signature_arity(&self) -> usize

Backward-compatible alias for Self::call_arity.

Source

pub fn required_arity(&self) -> usize

Backward-compatible alias for Self::required_call_arity.

Source

pub fn signature_params( &self, ) -> impl DoubleEndedIterator<Item = &FunctionParam> + Clone

Backward-compatible alias for Self::call_params.

Source

pub fn output_params( &self, ) -> impl DoubleEndedIterator<Item = &FunctionParam> + Clone

Parameters that shape the result row: OUT + INOUT + RETURNS TABLE columns, in declaration order.

Source

pub fn output_arity(&self) -> usize

Number of declared output parameters, including RETURNS TABLE columns.

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CreateFunction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CreateFunction

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for CreateFunction

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.