pub struct MaintenanceSyntax {
pub vacuum: bool,
pub vacuum_analyze: bool,
pub reindex: bool,
pub analyze: bool,
pub analyze_columns: bool,
pub checkpoint: bool,
pub checkpoint_database: bool,
pub table_maintenance: bool,
}Expand description
Dialect-owned physical-maintenance-statement syntax accepted by the parser.
The storage-maintenance statements and their operands. Split out of UtilitySyntax
at its 16-field line as the maintenance axis, distinct from the introspection and
access-control axes. Each flag is a leading-keyword dispatch gate: when off the keyword
is not dispatched and surfaces as an unknown statement.
Fields§
§vacuum: boolAccept the SQLite VACUUM [<schema>] [INTO <expr>] database-compaction
statement. SQLite-only (and the permissive superset). It takes its own flag
rather than sharing one with reindex/analyze because the three are
independent maintenance statements, not an inverse pair like ATTACH/DETACH
— the copy/comment_on precedent (separate flags even though every shipped
dialect toggles them together). PostgreSQL also has a (differently-shaped)
VACUUM, which is not modelled, so this stays off there; when off the leading
keyword is not dispatched and surfaces as an unknown statement.
vacuum_analyze: boolAccept DuckDB’s VACUUM [ANALYZE] [<table> [(<col>, …)]] statistics/compaction
statement — a separate leading-VACUUM base gate from SQLite’s
vacuum (the two dialects’ VACUUM operand grammars
are disjoint: SQLite’s [<schema>] INTO <expr> versus DuckDB’s [ANALYZE] <table> (<cols>)), so the leading keyword dispatches when either is on and the parser
reads whichever tail its gate admits. On for DuckDB/Lenient; off elsewhere. DuckDB’s
VACUUM admits only the ANALYZE option — 1.5.4’s transform throws
NotImplementedException on FULL/FREEZE/VERBOSE/disable_page_skipping, so
those never parse and this gate never over-accepts them. Independent of
vacuum: a dialect can admit one VACUUM grammar
without the other.
The column list is bundled here rather than split into a
vacuum_analyze_columns sibling of
analyze_columns — a deliberate
granularity asymmetry. The ANALYZE split is measured necessity: two engines
share the leading ANALYZE but differ on the column list (SQLite has
analyze without
analyze_columns; DuckDB has both). No
second engine shares this VACUUM grammar, and DuckDB’s grammar ties the column
list to the table operand inseparably — engine-measured on 1.5.4, VACUUM (a)
without a table reads the parens as the PG-legacy options list
(Parser Error: unrecognized VACUUM option "a"), not columns — so a split flag
would have no independent surface to gate. Split only when a second dialect’s
measured grammar demands it.
reindex: boolAccept the SQLite REINDEX [<name>] index-rebuild statement. SQLite-only (and
the permissive superset); its own flag for the same reason as
vacuum. Off elsewhere.
analyze: boolAccept the SQLite ANALYZE [<name>] / DuckDB ANALYZE [<table>] statistics
statement (a leading ANALYZE; the ANALYZE option inside EXPLAIN is
unaffected). On for SQLite/DuckDB (and the permissive superset); its own flag for
the same reason as vacuum. Off elsewhere.
analyze_columns: boolAccept DuckDB’s optional parenthesized column list on top of the base
analyze statement (ANALYZE <table> (<col>, …); the
dependency is FeatureDependencyViolation::AnalyzeColumnsWithoutAnalyze). DuckDB-only
among the shipped presets (and Lenient); SQLite’s ANALYZE takes no column list, so
it is off there and the trailing ( surfaces as a parser error.
This split exists because two engines share the base
analyze statement and differ only on the column
list; the DuckDB VACUUM column list has no such second consumer, so it stays
bundled inside vacuum_analyze — see that
flag’s doc for the measured justification of the granularity asymmetry.
checkpoint: boolAccept the bare CHECKPOINT write-ahead-log flush statement. On for
PostgreSQL/DuckDB/Lenient (both engines accept a bare CHECKPOINT — measured on
pg_query PG-17 and DuckDB 1.5.4); off in ANSI/MySQL/SQLite, where the leading
keyword is not dispatched and surfaces as an unknown statement. The DuckDB FORCE
modifier and database operand ride the separate
checkpoint_database gate (PostgreSQL rejects both).
checkpoint_database: boolAccept DuckDB’s [FORCE] CHECKPOINT [<database>] operands on top of the base
checkpoint statement (the dependency is
FeatureDependencyViolation::CheckpointDatabaseWithoutCheckpoint): the optional
FORCE modifier and the
optional single database name. DuckDB-only among the shipped presets (and Lenient);
PostgreSQL’s CHECKPOINT takes no operands (FORCE CHECKPOINT and CHECKPOINT db
are pg_query parser errors), so it is off there and both forms reject.
table_maintenance: boolAccept the MySQL admin-table maintenance verbs {ANALYZE | CHECK | CHECKSUM | OPTIMIZE | REPAIR} {TABLE | TABLES} <table-list> [options] (all →
Statement::TableMaintenance). One
behaviour gate for the whole five-verb family rather than one flag per verb: the
verb is DATA on the TableMaintenanceKind axis,
not a separate behaviour axis — every member is MySQL-only and they travel together
(the show_admin precedent). On for MySQL/Lenient only; off in every other preset,
where the leading verb is not dispatched and surfaces as an unknown statement.
The dispatch is MECE with the SQLite/DuckDB leading-ANALYZE
analyze gate: MySQL’s ANALYZE always takes
{TABLE | TABLES} (optionally after the NO_WRITE_TO_BINLOG | LOCAL prefix), so
the lookahead insists on that follow-set before claiming the keyword; a bare
ANALYZE still falls through to the sibling gate.
Implementations§
Source§impl MaintenanceSyntax
impl MaintenanceSyntax
Sourcepub const DATABRICKS: Self
Available on crate feature databricks only.
pub const DATABRICKS: Self
databricks only.The DATABRICKS preset for maintenance syntax.
Trait Implementations§
Source§impl Clone for MaintenanceSyntax
impl Clone for MaintenanceSyntax
Source§fn clone(&self) -> MaintenanceSyntax
fn clone(&self) -> MaintenanceSyntax
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more