pub struct SelectStatement {
pub ctes: Vec<Cte>,
pub distinct: bool,
pub items: Vec<SelectItem>,
pub from: Option<FromClause>,
pub where_: Option<Expr>,
pub group_by: Option<Vec<Expr>>,
pub group_by_all: bool,
pub having: Option<Expr>,
pub unions: Vec<(UnionKind, SelectStatement)>,
pub order_by: Vec<OrderBy>,
pub limit: Option<LimitExpr>,
pub offset: Option<LimitExpr>,
}Fields§
§ctes: Vec<Cte>v4.11: WITH name AS (SELECT ...) [, ...] common-table
expressions, materialised once at query start before the
body SELECT runs. Empty for a regular SELECT. Non-recursive
only — no WITH RECURSIVE for v4.x.
distinct: bool§items: Vec<SelectItem>§from: Option<FromClause>§where_: Option<Expr>§group_by: Option<Vec<Expr>>§group_by_all: boolv6.4.1 — GROUP BY ALL shortcut: when true, the planner
expands group_by to every non-aggregate SELECT-list item
before the executor runs. Mutually exclusive with an
explicit group_by list (the parser sets exactly one).
having: Option<Expr>HAVING <expr> — filter applied after GROUP BY aggregation.
Supports aggregate calls (e.g. HAVING count(*) > 1); the
aggregate executor resolves them through the same synthetic
schema used for the SELECT items.
unions: Vec<(UnionKind, SelectStatement)>UNION / UNION ALL chain. Empty for a plain SELECT. Each peer is
itself a SelectStatement with order_by = None and limit = None (the parser enforces that — ORDER BY / LIMIT belong to the
top of the chain).
order_by: Vec<OrderBy>v6.4.0 — multi-key ORDER BY. Empty Vec means no ORDER BY.
Keys are matched left-to-right: first key decides, ties break
to the second, etc.
limit: Option<LimitExpr>LIMIT <n> — bound on row output. n is an integer
literal or (v7.9.24) a placeholder $N resolved
against the prepared-statement Bind values. mailrs
migration follow-up H2.
offset: Option<LimitExpr>OFFSET <n> — drop the first n rows after ORDER BY but
before LIMIT (so LIMIT 10 OFFSET 5 keeps rows 6..=15).
Implementations§
Source§impl SelectStatement
v7.9.24 — extract LIMIT / OFFSET as a u32 literal. After
the engine’s substitute_placeholders pass these are
always Literal; in the simple-query path a Placeholder
shape returns None (executor surfaces as
“LIMIT/OFFSET ${n} requires prepared-statement binding”).
impl SelectStatement
v7.9.24 — extract LIMIT / OFFSET as a u32 literal. After
the engine’s substitute_placeholders pass these are
always Literal; in the simple-query path a Placeholder
shape returns None (executor surfaces as
“LIMIT/OFFSET ${n} requires prepared-statement binding”).
pub fn limit_literal(&self) -> Option<u32>
pub fn offset_literal(&self) -> Option<u32>
Trait Implementations§
Source§impl Clone for SelectStatement
impl Clone for SelectStatement
Source§fn clone(&self) -> SelectStatement
fn clone(&self) -> SelectStatement
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 SelectStatement
impl Debug for SelectStatement
Source§impl Display for SelectStatement
impl Display for SelectStatement
Source§impl PartialEq for SelectStatement
impl PartialEq for SelectStatement
Source§fn eq(&self, other: &SelectStatement) -> bool
fn eq(&self, other: &SelectStatement) -> bool
self and other values to be equal, and is used by ==.