pub struct CommonTableExpr {
pub name: String,
pub columns: Option<Vec<String>>,
pub query: Box<SelectStmt>,
pub recursive: bool,
pub materialization: CteMaterialization,
}Expand description
Common Table Expression (CTE) definition
CTEs are temporary named result sets defined with the WITH clause that exist only for the duration of a single query.
Example: WITH regional_sales AS (SELECT region, SUM(amount) FROM orders GROUP BY region)
Recursive CTEs use UNION ALL to reference themselves:
Example: WITH RECURSIVE counter(x) AS (VALUES(0) UNION ALL SELECT x+1 FROM counter WHERE x<10)
Fields§
§name: StringName of the CTE
columns: Option<Vec<String>>Optional column name list (e.g., WITH cte (col1, col2) AS (...))
query: Box<SelectStmt>The query defining the CTE
recursive: boolWhether this is a RECURSIVE CTE (SQLite/SQL:1999) Recursive CTEs must use UNION ALL and may reference themselves in the recursive term
materialization: CteMaterializationMaterialization hint for optimizer control (AS MATERIALIZED / AS NOT MATERIALIZED)
Trait Implementations§
Source§impl Clone for CommonTableExpr
impl Clone for CommonTableExpr
Source§fn clone(&self) -> CommonTableExpr
fn clone(&self) -> CommonTableExpr
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CommonTableExpr
impl Debug for CommonTableExpr
Source§impl PartialEq for CommonTableExpr
impl PartialEq for CommonTableExpr
Source§impl ToSql for CommonTableExpr
impl ToSql for CommonTableExpr
impl StructuralPartialEq for CommonTableExpr
Auto Trait Implementations§
impl Freeze for CommonTableExpr
impl RefUnwindSafe for CommonTableExpr
impl Send for CommonTableExpr
impl Sync for CommonTableExpr
impl Unpin for CommonTableExpr
impl UnwindSafe for CommonTableExpr
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