pub enum CteBody {
Select(SelectStatement),
Insert(Box<InsertStatement>),
Update(Box<UpdateStatement>),
Delete(Box<DeleteStatement>),
Merge(Box<MergeStatement>),
}Expand description
v7.37.43-T4.4 — CTE body. Read-only (Select) or data-modifying (Insert / Update / Delete with optional RETURNING). The data-modifying variants must carry a RETURNING projection for the outer query to reference the CTE alias by; an empty RETURNING is only valid if no outer reference materialises (rare — typically caught at planning).
Variants§
Select(SelectStatement)
Insert(Box<InsertStatement>)
Update(Box<UpdateStatement>)
Delete(Box<DeleteStatement>)
Merge(Box<MergeStatement>)
v7.39 (read01 round 149) — PG 17 allows MERGE as a
data-modifying CTE body (WITH m AS (MERGE … RETURNING …)).
Implementations§
Source§impl CteBody
impl CteBody
Sourcepub fn as_select(&self) -> Option<&SelectStatement>
pub fn as_select(&self) -> Option<&SelectStatement>
Convenience accessor used by classical (read-only) CTE
callsites that still expect a SELECT body. Returns None for
data-modifying CTEs; callers must explicitly route those
through exec_with_ctes’s modifying branch.
pub fn as_select_mut(&mut self) -> Option<&mut SelectStatement>
pub fn is_modifying(&self) -> bool
Trait Implementations§
impl StructuralPartialEq for CteBody
Auto Trait Implementations§
impl Freeze for CteBody
impl RefUnwindSafe for CteBody
impl Send for CteBody
impl Sync for CteBody
impl Unpin for CteBody
impl UnsafeUnpin for CteBody
impl UnwindSafe for CteBody
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
Mutably borrows from an owned value. Read more