pub enum PlPgSqlStmt {
Assign {
target: AssignTarget,
value: Expr,
},
Return(ReturnTarget),
If {
branches: Vec<(Expr, Vec<PlPgSqlStmt>)>,
else_branch: Vec<PlPgSqlStmt>,
},
Raise {
level: RaiseLevel,
message: String,
args: Vec<Expr>,
},
EmbeddedSql(Box<Statement>),
}Variants§
Assign
NEW.col := expr; or OLD.col := expr;. OLD is parsed
for clarity in error reporting (PG also forbids it) — the
executor errors with a clear “OLD is read-only” message.
Return(ReturnTarget)
RETURN <target>; — trigger functions canonically return
NEW / OLD / NULL; v7.12.4 also accepts a bare
expression for forward compatibility with scalar UDFs.
If
v7.12.6 — IF cond THEN body [ELSIF cond THEN body]* [ELSE body] END IF;. Branches are tried in order; first
truthy condition wins; the optional ELSE runs when no
condition matched.
Raise
v7.12.6 — RAISE <level> '<fmt>' [, args]*;. Level is one
of NOTICE / WARNING / INFO / LOG / DEBUG
(logging — observable side effect only) or EXCEPTION
(aborts the trigger and propagates as an error). v7.12.6
supports the basic format-string substitution PG uses
(% placeholders consumed positionally).
EmbeddedSql(Box<Statement>)
v7.12.6 — embedded SQL statement inside the trigger body
(INSERT INTO …, UPDATE …, DELETE FROM …, SELECT …).
NEW.col / OLD.col references inside the embedded
statement’s expression tree are substituted with the
current trigger context before the engine re-executes the
statement. Recursion depth into nested triggers is
bounded by the engine’s existing trigger-fire guard.
Trait Implementations§
Source§impl Clone for PlPgSqlStmt
impl Clone for PlPgSqlStmt
Source§fn clone(&self) -> PlPgSqlStmt
fn clone(&self) -> PlPgSqlStmt
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 PlPgSqlStmt
impl Debug for PlPgSqlStmt
Source§impl Display for PlPgSqlStmt
impl Display for PlPgSqlStmt
Source§impl PartialEq for PlPgSqlStmt
impl PartialEq for PlPgSqlStmt
Source§fn eq(&self, other: &PlPgSqlStmt) -> bool
fn eq(&self, other: &PlPgSqlStmt) -> bool
self and other values to be equal, and is used by ==.