Skip to main content

ShowSyntax

Struct ShowSyntax 

Source
pub struct ShowSyntax {
    pub describe: bool,
    pub describe_summarize: bool,
    pub session_statements: bool,
    pub show_tables: bool,
    pub show_columns: bool,
    pub show_create_table: bool,
    pub show_functions: bool,
    pub show_routine_status: bool,
    pub show_verbose: bool,
    pub show_admin: bool,
}
Expand description

Dialect-owned SHOW/DESCRIBE introspection-statement syntax accepted by the parser.

The session SHOW/SET/RESET reader, the typed SHOW <object> catalogue listings, and the MySQL/DuckDB DESCRIBE/SUMMARIZE introspection statements. Split out of UtilitySyntax at its 16-field line as the introspection axis. Each flag is a leading-keyword dispatch gate: when off the keyword is not dispatched and surfaces as an unknown statement (or the typed-SHOW lookahead falls through to the session reader).

Fields§

§describe: bool

Accept MySQL’s DESCRIBE/DESC keywords as EXPLAIN synonyms and the MySQL {DESCRIBE | DESC | EXPLAIN} <table> [<column> | '<pattern>'] table-metadata overload. MySQL-only (and the permissive superset). When on: the leading DESCRIBE and DESC keywords are dispatched into the EXPLAIN grammar (spelling recorded on ExplainStatement), and all three EXPLAIN-family keywords additionally accept a table name in place of an explainable statement (yielding a DescribeStatement). When off (ANSI/PostgreSQL/SQLite): DESCRIBE/DESC are not statement leaders and EXPLAIN keeps its plain query-plan-only grammar, so a table after EXPLAIN is rejected as PostgreSQL does. EXPLAIN itself stays ungated (accepted everywhere).

§describe_summarize: bool

Accept DuckDB’s leading-keyword {DESCRIBE | SUMMARIZE} <query> | <table> introspection statement (Statement::ShowRef). DuckDB desugars it to SELECT * FROM (<SHOW_REF>), so it reuses the same SHOW_REF core (ShowRef) as the parenthesized table factor, only at statement-leading position. DuckDB-only (and the permissive superset).

Distinct from describe: that flag is MySQL’s overload of the EXPLAIN keyword (DESCRIBE as a query-plan synonym, plus the <table> [<column>] metadata form) and never touches SUMMARIZE; this one is DuckDB’s SHOW_REF utility, whose DESCRIBE/SUMMARIZE return the target’s schema / summary statistics as a relation. The two share the DESCRIBE leader but are not a GrammarConflict: every real-dialect preset enables at most one, and Lenient — the one preset with both on — resolves the shared leader deterministically by dispatch order (DESCRIBE/DESC route to the MySQL EXPLAIN synonym above; only SUMMARIZE reaches this SHOW_REF utility), a conflict-free permissive union rather than a mutual exclusion, so no registry variant governs it. Boundary with TableFactorSyntax::show_ref: that flag owns the same core inside a FROM (…) table factor; this one owns the statement-leading spelling — one production, two grammar positions, one flag each.

§session_statements: bool

Accept the session statements SET <var> … / RESET … / SHOW … (PostgreSQL/ MySQL; the standard SET CONSTRAINTS/SET SESSION CHARACTERISTICS also route here). On for ANSI/PostgreSQL/MySQL/DuckDB/Lenient. SQLite has no session-variable statement, so it is off; the leading keyword is then not dispatched and surfaces as an unknown statement. SET TRANSACTION is transaction control (claimed earlier in dispatch), so it is unaffected by this gate.

§show_tables: bool

Accept the typed SHOW [EXTENDED] [FULL] [ALL] TABLES [{FROM | IN} <db>] [LIKE '<pat>' | WHERE <expr>] catalogue-listing statement (Statement::Show). On for MySQL/DuckDB/Lenient; off for ANSI/PostgreSQL/SQLite.

This is a refinement of the generic-SHOW dispatch, so its boundary with the two other SHOW seams is MECE:

  • session_statements owns the generic top-level SHOW <var> that reads one configuration parameter. When show_tables is on, a top-level SHOW whose next word (past the optional EXTENDED/FULL/ALL modifiers) is TABLES is claimed here instead; every other SHOW <var> still falls through to the session statement. So PostgreSQL (this flag off) keeps parsing SHOW tables as a generic session SHOW — the parse it already accepts — and only MySQL/DuckDB reinterpret the TABLES keyword as the catalogue listing.
  • TableFactorSyntax::show_ref owns the parenthesized (SHOW <name>) / (DESCRIBE …) table factor that only appears inside a FROM (…) and yields a relation; it never reaches the statement-leading position this flag governs.

One flag per typed-SHOW subform (the sibling SHOW COLUMNS/SHOW CREATE TABLE/ SHOW FUNCTIONS tickets add their own), because their per-dialect availability differs — the copy/comment_on separate-flags precedent. Once on, the single flag admits the whole modifier union permissively (MySQL’s FULL/LIKE/WHERE, DuckDB’s ALL), the DESCRIBE/PRAGMA single-flag-utility precedent — the corpus verdict gate catches only corpus-present over-acceptance.

§show_columns: bool

Accept the typed SHOW [EXTENDED] [FULL] {COLUMNS | FIELDS} {FROM | IN} <tbl> [{FROM | IN} <db>] [LIKE '<pat>' | WHERE <expr>] column-listing statement (Statement::Show with ShowTarget::Columns). On for MySQL/Lenient only; off for ANSI/PostgreSQL/SQLite/DuckDB.

A separate gate from show_tables because its per-dialect availability differs: DuckDB accepts SHOW [ALL] TABLES but has no SHOW COLUMNS grammar at all (every SHOW {COLUMNS | FIELDS} … form is ER_PARSE_ERROR on DuckDB 1.5.4, engine-probed — it uses DESCRIBE / SHOW <table> instead), so a shared flag would over-accept there. Same MECE refinement of the generic-SHOW dispatch as show_tables: a top-level SHOW whose next word past the optional EXTENDED/FULL modifiers is COLUMNS or the FIELDS synonym is claimed here; every other SHOW <var> still falls through to session_statements, and the parenthesized (SHOW <name>) show_ref table factor is untouched. Once on, the single flag admits the whole MySQL modifier/filter union permissively (the DESCRIBE/PRAGMA single-flag-utility precedent).

§show_create_table: bool

Accept the typed SHOW CREATE TABLE <tbl> statement — the CREATE TABLE DDL that would recreate the named table (Statement::Show with ShowTarget::Create and ShowCreateKind::Table). On for MySQL/Lenient only; off for ANSI/PostgreSQL/SQLite/DuckDB. The other SHOW CREATE <kind> object kinds ride show_admin.

A separate gate from show_tables/show_columns because its per-dialect availability differs: MySQL has SHOW CREATE TABLE but DuckDB has no such grammar (it uses SELECT sql FROM duckdb_tables / .schema), so a shared flag would over-accept there. Same MECE refinement of the generic-SHOW dispatch: a top-level SHOW whose next two words are CREATE TABLE is claimed here; a bare SHOW create (the two-keyword lookahead requires TABLE to follow) and every other SHOW <var> still fall through to session_statements, so PostgreSQL’s generic SHOW <var> reading create as the variable name is undisturbed. There are no EXTENDED/FULL modifiers on this subform (MySQL docs). Only the TABLE object kind is modelled; SHOW CREATE {DATABASE | VIEW | …} is deferred to sibling tickets.

§show_functions: bool

Accept the typed SHOW [{USER | SYSTEM | ALL}] FUNCTIONS [{FROM | IN} <schema>] [[LIKE] {<function_name> | '<regex>'}] function-listing statement (Statement::Show with ShowTarget::Functions). On for Databricks/Lenient only; off for ANSI/PostgreSQL/MySQL/SQLite/DuckDB.

A separate gate from the other show_* subforms because its per-dialect availability differs — and it is the first typed-SHOW flag on under Databricks, where the other three are off. Spark/Databricks are the only shipped engines with a bare SHOW FUNCTIONS listing (doc-cited grammar); MySQL’s SHOW FUNCTION STATUS is a different routine-catalogue statement (deferred to its own ticket), and DuckDB has no SHOW FUNCTIONS grammar at all — SHOW <name> there is a DESCRIBE alias, so SHOW functions describes a table named functions (engine-probed on 1.5.4), a generic-SHOW reinterpretation a shared flag would corrupt. Same MECE refinement of the generic-SHOW dispatch: a top-level SHOW whose next word (past the optional USER/SYSTEM/ALL scope) is FUNCTIONS is claimed here; a bare SHOW <var> (including SHOW ALL with no FUNCTIONS) still falls through to session_statements. Once on, the single flag admits the whole modifier/filter union permissively (the DESCRIBE/PRAGMA single-flag-utility precedent).

§show_routine_status: bool

Accept the typed SHOW {FUNCTION | PROCEDURE} STATUS [LIKE '<pat>' | WHERE <expr>] stored-routine catalogue listing (Statement::Show with ShowTarget::RoutineStatus). On for MySQL/Lenient only; off for ANSI/PostgreSQL/SQLite/DuckDB/Databricks.

A separate gate from show_functions because it is a different statement, not the same one under another dialect: MySQL’s routine catalogue takes the singular FUNCTION/PROCEDURE object keyword plus a mandatory STATUS and lists a row per stored routine, where the Spark/Databricks show_functions listing takes the bare plural FUNCTIONS and lists function names. Their per-dialect availability is disjoint (MySQL rejects SHOW FUNCTIONS, Databricks rejects SHOW FUNCTION STATUS), so a shared flag would over-accept in both directions — the one-flag-per-typed-SHOW-subform precedent. Same MECE refinement of the generic-SHOW dispatch as the sibling gates: a top-level SHOW whose next two words are FUNCTION STATUS or PROCEDURE STATUS is claimed here. The two-keyword lookahead steals only that full prefix; FUNCTION/PROCEDURE are reserved keywords, so a bare SHOW FUNCTION cannot be a generic session SHOW <var> (like SHOW CREATE, it is a parse error both ways), and every other SHOW <var> still falls through to session_statements. There is no scope keyword and no {FROM | IN} qualifier — SHOW FUNCTION STATUS FROM db is ER_PARSE_ERROR on mysql:8 (engine-probed) — only the optional LIKE/WHERE narrowing, which reuses the shared ShowFilter.

§show_verbose: bool

Accept the trailing VERBOSE on a generic session SHOWSHOW ALL VERBOSE, SHOW <setting> VERBOSE — carried on SessionStatement::Show::verbose. On for Lenient only; off for every oracle-backed dialect.

VERBOSE here is the sqlparser-rs/DataFusion planner spelling, not a database grammar: pg_query and DuckDB both reject SHOW ALL VERBOSE and SHOW <setting> VERBOSE (engine-probed), so no dialect with a real oracle can turn it on without diverging. It refines only the session SHOW seam and never the typed-SHOW dispatch: the TABLES/COLUMNS/CREATE TABLE/FUNCTIONS lookaheads each insist on their keyword after the modifiers, so SHOW ALL VERBOSE (no TABLES) falls through to the session branch and SHOW ALL TABLES stays typed — the seams remain MECE. A behaviour-named tail flag, not gated on session_statements: where session SHOW is off (SQLite) the keyword is never dispatched, so this flag is inert there regardless.

§show_admin: bool

Accept the MySQL server-administration / catalogue-introspection SHOW sub-command family — the ~40 SHOW productions beyond the individually-gated TABLES/COLUMNS/CREATE TABLE/{FUNCTION|PROCEDURE} STATUS subforms: SHOW DATABASES, SHOW [GLOBAL|SESSION] {STATUS|VARIABLES}, SHOW PLUGINS, SHOW [STORAGE] ENGINES, SHOW ENGINE <e> {STATUS|MUTEX|LOGS}, SHOW PRIVILEGES, SHOW {CHARACTER SET|CHARSET}, SHOW COLLATION, SHOW EVENTS, SHOW TABLE STATUS, SHOW OPEN TABLES, SHOW [FULL] TRIGGERS, SHOW [FULL] PROCESSLIST, SHOW CREATE {VIEW|DATABASE|EVENT|PROCEDURE|FUNCTION|TRIGGER} <name>, SHOW [EXTENDED] {INDEX|INDEXES|KEYS} FROM <t>, SHOW GRANTS, SHOW {WARNINGS|ERRORS} [LIMIT …] / SHOW COUNT(*) {WARNINGS|ERRORS}, SHOW BINARY LOGS, SHOW REPLICAS, SHOW BINARY LOG STATUS, SHOW REPLICA STATUS [FOR CHANNEL …], SHOW PROFILES, and SHOW {PROCEDURE|FUNCTION} CODE <name> (all → Statement::Show). On for MySQL/Lenient only; off for every other preset.

This is a single behaviour flag for the whole family rather than one flag per sub-command (the show_tables/show_columns precedent) because, unlike those, this family’s per-dialect availability does not vary — every member is MySQL-only and they travel together; the sub-command identity is DATA (the ShowTarget Listing/Bare/Create/Index/Engine/… axis), not a separate behaviour axis. The parser reaches it through one table-driven dispatch (parse_show_admin_statement), not one arm per keyword. Same MECE refinement of the generic-SHOW dispatch as the sibling gates: the lookahead insists on one of the family’s lead keywords, so any other SHOW <var> still falls through to session_statements. The gate also covers the grammatically heavier subforms with operands (SHOW GRANTS FOR <user> [USING …], SHOW CREATE USER, SHOW PROFILE, SHOW {BINLOG | RELAYLOG} EVENTS); when off, every family keyword falls through unclaimed.

Implementations§

Source§

impl ShowSyntax

Source

pub const ANSI: Self

The ANSI predefined value.

Source§

impl ShowSyntax

Source

pub const DATABRICKS: Self

Available on crate feature databricks only.

The DATABRICKS preset for show syntax.

Source§

impl ShowSyntax

Source

pub const DUCKDB: Self

Available on crate feature duckdb only.

The DUCKDB preset for show syntax.

Source§

impl ShowSyntax

Source

pub const LENIENT: Self

Available on crate feature lenient only.

The LENIENT preset for show syntax.

Source§

impl ShowSyntax

Source

pub const MYSQL: Self

Available on crate feature mysql only.

The MYSQL preset for show syntax.

Source§

impl ShowSyntax

Source

pub const POSTGRES: Self

Available on crate feature postgres only.

The POSTGRES preset for show syntax.

Source§

impl ShowSyntax

Source

pub const SQLITE: Self

Available on crate feature sqlite only.

The SQLITE preset for show syntax.

Trait Implementations§

Source§

impl Clone for ShowSyntax

Source§

fn clone(&self) -> ShowSyntax

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 ShowSyntax

Source§

impl Debug for ShowSyntax

Source§

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

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

impl Eq for ShowSyntax

Source§

impl PartialEq for ShowSyntax

Source§

fn eq(&self, other: &ShowSyntax) -> 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 ShowSyntax

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.