pub struct Join {
pub kind: JoinKind,
pub to: TableRef,
pub natural: bool,
pub on: Vec<Expr>,
pub using: Vec<Cow<'static, str>>,
pub using_alias: Option<Cow<'static, str>>,
}Expand description
[NATURAL] <kind> <table> [ON a AND b] [USING (cols) [AS alias]]
From PostgreSQL 17’s from_item:
from_item [ NATURAL ] join_type from_item
[ ON join_condition | USING ( join_column [, ...] ) [ AS join_using_alias ] ]ON and USING are alternatives, and NATURAL excludes both; nothing here
enforces that, because the check belongs to the mods that build a join — a
dialect exposes join::on(..) and join::using(..) as separate mods and the
caller picks one.
Fields§
§kind: JoinKindWhich join.
to: TableRefWhat is being joined to, with all of its own decorations.
natural: boolNATURAL, which derives the join columns from the two items’ names.
on: Vec<Expr>ON conditions, AND-joined.
using: Vec<Cow<'static, str>>USING columns, quoted on output.
using_alias: Option<Cow<'static, str>>USING (…) AS alias — a name for the row of merged join columns
(PostgreSQL 16+). Quoted on output. Belongs to the USING clause, so with
no using columns it is a recorded build error rather than
something to guess a rendering for.