pub struct CreateFunctionStatement {
pub name: String,
pub or_replace: bool,
pub args: Vec<FunctionArg>,
pub returns: FunctionReturn,
pub language: String,
pub body: FunctionBody,
}Expand description
v7.12.4 — CREATE [OR REPLACE] FUNCTION. v7.12.4 ships
RETURNS TRIGGER LANGUAGE plpgsql as the primary use case
(the row-level trigger body the CREATE TRIGGER below references).
Non-trigger user-defined functions parse but error at execution
time with a clear unsupported message; that surface lands in
v7.12.5+.
Fields§
§name: String§or_replace: boolOR REPLACE was present; an existing function with the
same name is overwritten instead of erroring.
args: Vec<FunctionArg>(arg1 type1, ...) — v7.12.4 only accepts the empty arg
list () (sufficient for trigger functions). Other shapes
parse and store the args but the executor refuses to call
them.
returns: FunctionReturnRETURNS <type> — trigger is the supported shape for
v7.12.4; arbitrary return types parse to
FunctionReturn::Other.
language: StringLANGUAGE <lang> clause. PG accepts the clause on either
side of AS $$...$$; the parser canonicalises to one slot.
plpgsql and sql are the two interesting values.
body: FunctionBodyAS $$ ... $$ body. v7.12.4 parses PL/pgSQL bodies into
a structured AST; non-trigger / non-plpgsql bodies stay as
the raw source text so the v7.12.5+ executor can pick them
up without a parser rev.
Trait Implementations§
Source§impl Clone for CreateFunctionStatement
impl Clone for CreateFunctionStatement
Source§fn clone(&self) -> CreateFunctionStatement
fn clone(&self) -> CreateFunctionStatement
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CreateFunctionStatement
impl Debug for CreateFunctionStatement
Source§impl Display for CreateFunctionStatement
impl Display for CreateFunctionStatement
Source§impl PartialEq for CreateFunctionStatement
impl PartialEq for CreateFunctionStatement
Source§fn eq(&self, other: &CreateFunctionStatement) -> bool
fn eq(&self, other: &CreateFunctionStatement) -> bool
self and other values to be equal, and is used by ==.