pub enum JoinConstraintKind {
On(Box<Expr>),
Using(Vec<String>),
Natural,
}Expand description
How a JOIN matches rows. SQLR-5 originally shipped ON only; the
USING / NATURAL increment adds the two name-based constraints.
ON carries its predicate straight from the parser. USING and
NATURAL defer their equality synthesis to the executor because
they need table schemas (which column names exist, and — for
NATURAL — which are shared) that the parser doesn’t have. The
executor turns both into the same left.col = right.col [AND …]
predicate the ON path already evaluates. CROSS JOIN is rewritten
to ON true at parse time (no schema needed) and so reuses the
On variant directly.
Variants§
On(Box<Expr>)
ON <expr> (and the parse-time rewrite of CROSS JOIN to
ON true). Evaluated per-row over the multi-table scope. Boxed
to keep this enum small — Expr dwarfs the other variants.
Using(Vec<String>)
USING (col[, col…]) — equality on each named column, plus the
SQLite convention that each named column appears once in
SELECT *. Columns are validated and the predicate is
synthesized at execution time.
Natural
NATURAL — the shared column names of the two sides are
discovered at execution time, then treated exactly like
USING (<shared cols>). No shared columns ⇒ a cross product.
Trait Implementations§
Source§impl Clone for JoinConstraintKind
impl Clone for JoinConstraintKind
Source§fn clone(&self) -> JoinConstraintKind
fn clone(&self) -> JoinConstraintKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more