pub struct CreateFunctionStatement {
pub name: String,
pub or_replace: bool,
pub args: Vec<FunctionArg>,
pub returns: FunctionReturn,
pub language: String,
pub body: FunctionBody,
pub attrs: FunctionAttrs,
}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.
attrs: FunctionAttrsv7.39 (round 322, V46) — IMMUTABLE / STRICT / PARALLEL SAFE /
SECURITY DEFINER / LEAKPROOF / COST / ROWS. PG accepts them
on either side of the body; before this they were a parse error, so
PG’s own pg_dump output would not restore.
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 more