pub struct TableExpressionSyntax {Show 15 fields
pub only: bool,
pub table_sample: bool,
pub parenthesized_joins: bool,
pub table_alias_column_lists: bool,
pub join_using_alias: bool,
pub index_hints: bool,
pub table_hints: bool,
pub partition_selection: bool,
pub base_table_alias_column_lists: bool,
pub string_literal_aliases: bool,
pub aliased_parenthesized_join: bool,
pub bare_table_alias_is_bare_label: bool,
pub table_version: bool,
pub table_json_path: bool,
pub indexed_by: bool,
}Expand description
Dialect-owned table-expression syntax extensions.
Fields§
§only: boolAccept PostgreSQL ONLY table / ONLY (table) inheritance suppression.
table_sample: boolAccept TABLESAMPLE method(args...) [REPEATABLE (...)].
parenthesized_joins: boolAccept joined tables as parenthesized table factors (FROM (a JOIN b) JOIN c).
On in every shipped preset — the standard join grouping — but stays gateable, so
a stricter dialect that forbids parenthesizing a join leaves it off and the form
then surfaces as a clean parse error.
table_alias_column_lists: boolAccept alias(column, ...) derived-column lists after table factors. On in every
shipped preset (the SQL-standard correlation-name column list), but stays gateable
so a dialect without the form can reject it as trailing input.
join_using_alias: boolAccept PostgreSQL JOIN ... USING (...) AS alias.
index_hints: boolAccept MySQL index hints ({USE|FORCE|IGNORE} {INDEX|KEY} [FOR …] (…)) as a
table-factor tail after the alias. MySQL-only, so it rides
TableFactor::Table::index_hints; when off the hint
keywords are left to the identifier grammar and the construct is a clean parse
divergence. On for MySQL / Lenient, off elsewhere.
table_hints: boolAccept MSSQL / T-SQL WITH ( <hint>, … ) table hints (WITH (NOLOCK),
WITH (INDEX(ix), FORCESEEK)) as a table-factor tail after the tablesample
clause. T-SQL-only, so it rides
TableFactor::Table::table_hints; when off the
trailing WITH is left unconsumed, so under ANSI/PostgreSQL — where WITH
introduces only a leading CTE clause at statement start — the construct is a
clean parse divergence. A separate axis from index_hints:
a different dialect (T-SQL vs MySQL) and a different grammar position. On for
MSSQL / Lenient, off elsewhere.
partition_selection: boolAccept MySQL explicit partition selection (PARTITION (p0, p1)) as a
table-factor tail between the table name and the alias. MySQL-only, so it rides
TableFactor::Table::partition; when off the
PARTITION keyword is left unconsumed and the construct is a clean parse
divergence. On for MySQL / Lenient, off elsewhere.
base_table_alias_column_lists: boolAccept a column-list alias (AS y(a, b)) on a base table factor
(FROM t AS y(a, b)). On for ANSI/PostgreSQL/SQLite/DuckDB/Lenient. MySQL admits a
column-list alias only on a derived table / subquery / table function
(FROM (SELECT …) AS c(x) parses on mysql:8, only bind-failing) and rejects one on
a base table (FROM t AS y(a, b) is an ER_PARSE_ERROR on mysql:8), so it is off
there; the ( after the base-table alias name is then a clean parse error. The
broader table_alias_column_lists gate governs
whether the dialect admits column-list aliases at all (for the derived/function
positions); this one further restricts the base-table position — the base-vs-derived
split MySQL draws.
string_literal_aliases: boolAccept a single-quoted string literal in table-alias position — both the
correlation name after an explicit AS (FROM integers AS 't') and each entry
of the alias column list (FROM integers AS 't'('k') / FROM integers t('k')),
reusing the projection alias’s string-literal round-trip. DuckDB admits this only
after AS: a bare FROM integers 't' is an engine reject (probed on 1.5.4),
preserved by the alias site’s leading-string guard.
Deliberately separate from SelectSyntax::alias_string_literals, which gates
the string spelling in projection position: the two profiles diverge. MySQL
accepts a string column alias (SELECT 1 AS 'x') but rejects a string table
alias (FROM t AS 't' — engine-measured-rejected on mysql:8), so folding both
onto one flag would make MySQL over-accept the table form. On for DuckDb /
Lenient, off elsewhere (including MySQL).
aliased_parenthesized_join: boolAccept a correlation alias on a parenthesized joined table
(FROM (a CROSS JOIN b) AS x). On for ANSI/PostgreSQL/SQLite/DuckDB/Lenient. MySQL
admits a parenthesized join (parenthesized_joins) but
rejects an alias on it ((a CROSS JOIN b) AS x is an ER_PARSE_ERROR on mysql:8,
while the bare (a CROSS JOIN b) and a derived-table (SELECT …) AS x both parse),
so it is off there and the trailing alias surfaces as a clean parse error. Only the
joined-table parenthesization is governed; a derived subquery’s alias rides the
always-accepted derived-table path.
bare_table_alias_is_bare_label: boolTreat a bare (AS-less) table correlation alias as a BareColLabel — routed to
FeatureSet::reserved_bare_alias — instead of the default ColId
(FeatureSet::reserved_column_name). Off for every dialect except SQLite, where
the bare alias is the narrow ids ::= ID|STRING grammar class (not the nm name
class): the seven JOIN_KW keywords are admissible as a table name (FROM cross)
yet reserved as a bare alias, so FROM t cross JOIN u must keep cross for the
join grammar rather than read it as t’s alias. Routing the bare-table-alias gate
to the bare-alias set (which reserves the JOIN keywords) while the table-name gate
stays on the permissive ColId set is what makes the two positions diverge — the
table-alias twin of SelectSyntax::as_alias_rejects_reserved. The explicit AS
table alias keeps the ColId set (SQLite’s AS nm admits the JOIN keywords).
table_version: boolAccept a table version / time-travel modifier on a base table, written between the
table name and the alias: BigQuery/MSSQL FOR SYSTEM_TIME …, MSSQL’s five temporal
forms (AS OF, FROM … TO, BETWEEN … AND, CONTAINED IN, ALL), and
Databricks/Delta VERSION/TIMESTAMP AS OF. Rides
TableFactor::Table::version; when off the clause keyword
is left unconsumed, so a query-level FOR (row locking, MSSQL FOR XML) still parses
— the two FOR surfaces are position-partitioned, this one at the table factor and
the query-level ones after the whole FROM/WHERE. On for BigQuery / MSSQL /
Databricks / Lenient, off elsewhere.
table_json_path: boolAccept a PartiQL / SUPER JSON path navigating into a semi-structured column at the
table-source position, attached directly to the table name (FROM src[0].a,
FROM src[0].a[1].b). Redshift’s SUPER navigation and Snowflake’s PartiQL access
(sqlparser-rs’s supports_partiql). Rides
TableFactor::Table::json_path; the path is entered only
by a [ immediately after the name (a bracket index root, then .key / [index]
suffixes), so a dotted FROM src.a.b stays a compound relation name. When off the
[ is left unconsumed and the construct is a clean parse divergence. Because the
entry trigger is the [ tokenizer trigger, this shares the
BracketIdentifierVersusArraySyntax hazard: a
dialect with a [ identifier quote cannot also enable it. On for Snowflake /
Redshift, off elsewhere — including Lenient, whose [ bracket identifier quote claims
the trigger (the same reason Lenient keeps subscript / collection_literals off).
indexed_by: boolAccept a SQLite INDEXED BY <index> / NOT INDEXED index directive on a base table,
written after the table name and its optional alias (FROM t AS e INDEXED BY ix,
FROM t NOT INDEXED). Rides
TableFactor::Table::indexed_by. When on, a bare
INDEXED at the base-table alias position is declined as a correlation alias so the
directive is reachable (the CONNECT BY clause-decline precedent), which is what
makes SQLite reject a bare FROM t indexed while still admitting indexed as an
identifier everywhere else (SELECT indexed, t AS indexed, indexed INT). A
separate axis from MySQL index_hints: a
different dialect, grammar, and cardinality. On for SQLite, off elsewhere — including
Lenient, whose maximal-accept goal keeps a bare FROM t indexed an ordinary alias
(the directive-versus-bare-alias readings are mutually exclusive given the keyword’s
one-position semantics, and Lenient prefers the more permissive bare-alias reading).
Implementations§
Source§impl TableExpressionSyntax
impl TableExpressionSyntax
Sourcepub const BIGQUERY: Self
Available on crate feature bigquery only.
pub const BIGQUERY: Self
bigquery only.BigQuery table-expression surface: the ANSI baseline plus the FOR SYSTEM_TIME AS OF
time-travel modifier. The first-class UNNEST(…) factor and its WITH OFFSET tail
ride TableFactorSyntax; every other table knob is conservatively ANSI.
Source§impl TableExpressionSyntax
impl TableExpressionSyntax
Sourcepub const DATABRICKS: Self
Available on crate feature databricks only.
pub const DATABRICKS: Self
databricks only.Databricks table-expression surface: the ANSI baseline plus the Delta/Databricks
VERSION/TIMESTAMP AS OF time-travel modifiers. The sided {LEFT|RIGHT} {SEMI|ANTI} JOIN family rides JoinSyntax; the side-less DuckDB SEMI JOIN
spelling stays off pending SEMI/ANTI bare-alias reservation modelling. Every
other table knob is conservatively ANSI.
Source§impl TableExpressionSyntax
impl TableExpressionSyntax
Sourcepub const HIVE: Self
Available on crate feature hive only.
pub const HIVE: Self
hive only.Hive table-expression surface: the ANSI baseline plus the sided
{LEFT|RIGHT} {SEMI|ANTI} JOIN family, whose flag doc names Hive as a motivating
dialect (Hive originated LEFT SEMI JOIN). The side-less DuckDB spelling
(semi_anti_join) stays off — it is a different engine family and needs SEMI/ANTI
bare-alias reservation modelling not done here. Every other table knob is conservatively
ANSI.
Source§impl TableExpressionSyntax
impl TableExpressionSyntax
Sourcepub const MSSQL: Self
Available on crate feature mssql only.
pub const MSSQL: Self
mssql only.MSSQL table-expression surface: the ANSI baseline plus the WITH (...) table-hint
tail and the temporal-table FOR SYSTEM_TIME modifier (all five forms). The
CROSS APPLY / OUTER APPLY join operators ride JoinSyntax; every other table
knob is conservatively ANSI.
Trait Implementations§
Source§impl Clone for TableExpressionSyntax
impl Clone for TableExpressionSyntax
Source§fn clone(&self) -> TableExpressionSyntax
fn clone(&self) -> TableExpressionSyntax
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more