Skip to main content

UpdateStatement

Struct UpdateStatement 

Source
pub struct UpdateStatement {
    pub ctes: Vec<Cte>,
    pub table: String,
    pub only: bool,
    pub alias: Option<String>,
    pub assignments: Vec<(String, Expr)>,
    pub from_sources: Option<Box<UpdateFromSources>>,
    pub where_: Option<Expr>,
    pub order_limit: Option<Box<DmlOrderLimit>>,
    pub returning: Option<Vec<SelectItem>>,
}

Fields§

§ctes: Vec<Cte>

v7.37.43-T4.4 — leading WITH cte AS (…) clauses on a top- level UPDATE. Empty for a plain UPDATE.

§table: String§only: bool

v7.39 (round 646) — UPDATE ONLY t / DELETE FROM ONLY t: apply to t’s own rows and not to anything that descends from it.

Round 644 taught the FROM clause the keyword and left DML behind because it needed a field here, and this struct carries a warning that round 413 measured widening it in place overflowing the parser’s nesting stack. That warning was about from_sources, a struct wide enough to need boxing; a bool lands in the padding already present — same as CreateTableStatement::temporary.

It also earns its keep beyond the spelling: the inheritance fan-out needs a way to say “the parent’s own rows” as a statement, or running one on the parent recurses forever.

§alias: Option<String>

v7.39 (round 241) — UPDATE t [AS] alias SET …: the name the statement’s expressions refer to the target row by. PG allows the bare spelling here (unlike INSERT, which requires AS).

§assignments: Vec<(String, Expr)>§from_sources: Option<Box<UpdateFromSources>>

v7.39 (round 533) — boxed: round 413 measured that widening this struct in place overflows the parser’s nesting stack.

§where_: Option<Expr>§order_limit: Option<Box<DmlOrderLimit>>

v7.39 (round 413) — MySQL’s UPDATE … [ORDER BY … [LIMIT n]]: mutate the first limit rows in the given order. PG has no such clause; the parser accepts it only under the MySQL dialect. Boxed so a PG UPDATE (the common case) grows this struct by ONE pointer, not Vec<OrderBy> + Option<u32> — a naked add tipped the parser’s 512 KiB nesting stack under a full workspace test (round 305 kin).

§returning: Option<Vec<SelectItem>>

v7.9.4 — RETURNING <projection>. None = no RETURNING clause (legacy CommandComplete path). Some = engine evaluates the projection over each mutated row and streams the result as a Rows QueryResult.

Trait Implementations§

Source§

impl Clone for UpdateStatement

Source§

fn clone(&self) -> UpdateStatement

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 UpdateStatement

Source§

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

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

impl Display for UpdateStatement

Source§

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

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

impl PartialEq for UpdateStatement

Source§

fn eq(&self, other: &UpdateStatement) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for UpdateStatement

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> 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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.