pub enum SetExpr<X: Extension = NoExt> {
Select {
select: Box<Select<X>>,
meta: Meta,
},
Values {
values: Box<Values<X>>,
meta: Meta,
},
Query {
query: Box<Query<X>>,
meta: Meta,
},
SetOperation {
op: SetOperator,
all: bool,
by_name: bool,
left: Box<SetExpr<X>>,
right: Box<SetExpr<X>>,
meta: Meta,
},
Pivot {
pivot: Box<Pivot<X>>,
meta: Meta,
},
Unpivot {
unpivot: Box<Unpivot<X>>,
meta: Meta,
},
}Expand description
The SQL set expr forms represented by the AST.
Variants§
Select
A SELECT query body.
Fields
Values
A VALUES (...) row-constructor query body.
Query
A parenthesized nested query body.
Fields
SetOperation
A set operation combining two query bodies (UNION/INTERSECT/EXCEPT).
Fields
op: SetOperatorOperator applied by this expression.
by_name: boolDuckDB’s UNION [ALL] BY NAME modifier: pair the two inputs’ columns by
name (padding a side’s missing columns with NULL) instead of by
position. A semantic modifier of the operation — it changes column
correspondence — so it is a flag on this node, not a spelling tag or a new
SetOperator variant (a semantic modifier is a shape field, a
pure spelling would be a tag). Orthogonal to all,
exactly as DuckDB models it — UNION [ALL] BY NAME serializes as
setop_type: UNION_BY_NAME with a separate setop_all (probed on 1.5.4).
DuckDB accepts BY NAME on UNION only (INTERSECT/EXCEPT BY NAME are
syntax errors; probed on 1.5.4), so the parser sets this true only for
SetOperator::Union. Gated by
SelectSyntax::union_by_name; false for
every ordinary (positional) set operation.
Pivot
DuckDB’s PIVOT operator standing as a query body — the CTE body, the
CREATE VIEW/CREATE TABLE AS/CREATE MACRO … AS TABLE body, or any other
query-body position (WITH p AS (PIVOT t ON x USING sum(y)) SELECT …,
CREATE VIEW v AS PIVOT t ON x IN (…) USING sum(y); both probed on 1.5.4).
DuckDB admits PIVOT/UNPIVOT at query-body position but not
DESCRIBE/SHOW (a CTE body with those is Parser Error: A CTE needs a SELECT), so this is a query-body variant — reusing the shared Pivot core
(tagged PivotSpelling::Statement) exactly as
Statement::Pivot and TableFactor::Pivot do — rather
than a general “statement in query position” carrier (which the
canonical-shape rule bans as a vibe-union, and which the divergent composition
of DESCRIBE/SHOW would misrepresent). Boxed to keep this hot enum within
its size budget. Gated by
TableFactorSyntax::pivot.
Fields
Unpivot
DuckDB’s UNPIVOT operator standing as a query body — the
Pivot counterpart, sharing the Unpivot core with
Statement::Unpivot and TableFactor::Unpivot. Gated by
TableFactorSyntax::unpivot.
Trait Implementations§
Source§impl<'de, X> Deserialize<'de> for SetExpr<X>where
X: Deserialize<'de> + Extension,
impl<'de, X> Deserialize<'de> for SetExpr<X>where
X: Deserialize<'de> + Extension,
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<X: Eq + Extension> Eq for SetExpr<X>
Source§impl<X: Extension + Render> Render for SetExpr<X>
impl<X: Extension + Render> Render for SetExpr<X>
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 moreimpl<X: PartialEq + Extension> StructuralPartialEq for SetExpr<X>
Auto Trait Implementations§
impl<X> Freeze for SetExpr<X>
impl<X> RefUnwindSafe for SetExpr<X>where
X: RefUnwindSafe,
impl<X> Send for SetExpr<X>where
X: Send,
impl<X> Sync for SetExpr<X>where
X: Sync,
impl<X> Unpin for SetExpr<X>
impl<X> UnsafeUnpin for SetExpr<X>
impl<X> UnwindSafe for SetExpr<X>where
X: UnwindSafe,
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.