Skip to main content

TableExpressionSyntax

Struct TableExpressionSyntax 

Source
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: bool

Accept PostgreSQL ONLY table / ONLY (table) inheritance suppression.

§table_sample: bool

Accept TABLESAMPLE method(args...) [REPEATABLE (...)].

§parenthesized_joins: bool

Accept 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: bool

Accept 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: bool

Accept PostgreSQL JOIN ... USING (...) AS alias.

§index_hints: bool

Accept 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: bool

Accept 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: bool

Accept 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: bool

Accept 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: bool

Accept 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: bool

Accept 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: bool

Treat 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: bool

Accept 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: bool

Accept 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: bool

Accept 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

Source

pub const ANSI: Self

The ANSI predefined value.

Source§

impl TableExpressionSyntax

Source

pub const BIGQUERY: Self

Available on crate feature 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

Source

pub const DATABRICKS: Self

Available on crate feature 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

Source

pub const DUCKDB: Self

Available on crate feature duckdb only.

The DUCKDB preset for table expression syntax.

Source§

impl TableExpressionSyntax

Source

pub const HIVE: Self

Available on crate feature 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

Source

pub const LENIENT: Self

Available on crate feature lenient only.

The LENIENT preset for table expression syntax.

Source§

impl TableExpressionSyntax

Source

pub const MSSQL: Self

Available on crate feature 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.

Source§

impl TableExpressionSyntax

Source

pub const MYSQL: Self

Available on crate feature mysql only.

The MYSQL preset for table expression syntax.

Source§

impl TableExpressionSyntax

Source

pub const POSTGRES: Self

Available on crate feature postgres only.

The POSTGRES preset for table expression syntax.

Source§

impl TableExpressionSyntax

Source

pub const SQLITE: Self

Available on crate feature sqlite only.

The SQLITE preset for table expression syntax.

Trait Implementations§

Source§

impl Clone for TableExpressionSyntax

Source§

fn clone(&self) -> TableExpressionSyntax

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TableExpressionSyntax

Source§

impl Debug for TableExpressionSyntax

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for TableExpressionSyntax

Source§

impl PartialEq for TableExpressionSyntax

Source§

fn eq(&self, other: &TableExpressionSyntax) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TableExpressionSyntax

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.