pub struct DoStatement {
pub args: ThinVec<DoArg>,
pub meta: Meta,
}Expand description
A PostgreSQL DO [LANGUAGE <lang>] '<body>' anonymous code block (gated by
UtilitySyntax::do_statement).
Runs an inline procedural-language block without defining a routine. The body is an
opaque source string in the target language (LiteralKind::String
— dollar-quoted in practice), never re-parsed here: like
FunctionOption::As the body’s grammar is the target
language, not SQL, so the PL text is not smuggled into the AST.
The shape mirrors CreateFunction’s option cluster
rather than a fixed { language, body } pair, because PostgreSQL’s raw grammar is the
same free option list: DO dostmt_opt_list, where dostmt_opt_list is a non-empty
sequence of items each either an Sconst body or LANGUAGE <word>, in any order and
with no arity limit. The parser (makeDefElem("as"/"language", …)) accepts a repeated
or missing body and a repeated language — DO LANGUAGE plpgsql (language, no body),
DO $$a$$ $$b$$ (two bodies), and DO 'x' LANGUAGE a LANGUAGE b (two languages) all
parse — and defers the “exactly one body, at most one language” check to execution
(ExecuteDoStmt), exactly as the PrepareStatement “grammar accepts any statement,
bind restricts the kind” contract defers its own semantic check. Modelling the list
faithfully is what keeps raw-parse accept/reject parity with libpg_query; collapsing it
to a single body/language pair would over-reject those three forms. The list is
non-empty (a bare DO is a syntax error), which the parser enforces.
Fields§
§args: ThinVec<DoArg>The dostmt_opt_list items in source order; always non-empty.
meta: MetaSource location and node identity.
Trait Implementations§
Source§impl Clone for DoStatement
impl Clone for DoStatement
Source§fn clone(&self) -> DoStatement
fn clone(&self) -> DoStatement
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 DoStatement
impl Debug for DoStatement
Source§impl<'de> Deserialize<'de> for DoStatement
impl<'de> Deserialize<'de> for DoStatement
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>,
impl Eq for DoStatement
Source§impl Hash for DoStatement
impl Hash for DoStatement
Source§impl PartialEq for DoStatement
impl PartialEq for DoStatement
Source§impl Render for DoStatement
impl Render for DoStatement
Source§fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result
fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result
Source§fn operand_binding_power(&self) -> Option<BindingPower>
fn operand_binding_power(&self) -> Option<BindingPower>
None (the default) for a self-delimiting node — an atom, call, or
constructor — that never needs parentheses. Read moreSource§impl Serialize for DoStatement
impl Serialize for DoStatement
impl StructuralPartialEq for DoStatement
Auto Trait Implementations§
impl Freeze for DoStatement
impl RefUnwindSafe for DoStatement
impl Send for DoStatement
impl Sync for DoStatement
impl Unpin for DoStatement
impl UnsafeUnpin for DoStatement
impl UnwindSafe for DoStatement
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>,
Source§impl<T> DynAstExt for T
impl<T> DynAstExt for T
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&dyn Any for downcasting a node back to its concrete type.Source§fn dyn_clone(&self) -> Box<dyn DynAstExt>
fn dyn_clone(&self) -> Box<dyn DynAstExt>
Clone (whose
Self-returning signature cannot go through a vtable).Source§fn dyn_eq(&self, other: &dyn DynAstExt) -> bool
fn dyn_eq(&self, other: &dyn DynAstExt) -> bool
PartialEq (whose &Self argument cannot go through a vtable). Equal
iff other holds the same concrete type and that type deems the values
equal; differently-typed nodes are never equal.