Skip to main content

MaintenanceSyntax

Struct MaintenanceSyntax 

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

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

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

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

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

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

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

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

Accept 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

Source

pub const ANSI: Self

The ANSI predefined value.

Source§

impl MaintenanceSyntax

Source

pub const DATABRICKS: Self

Available on crate feature databricks only.

The DATABRICKS preset for maintenance syntax.

Source§

impl MaintenanceSyntax

Source

pub const DUCKDB: Self

Available on crate feature duckdb only.

The DUCKDB preset for maintenance syntax.

Source§

impl MaintenanceSyntax

Source

pub const LENIENT: Self

Available on crate feature lenient only.

The LENIENT preset for maintenance syntax.

Source§

impl MaintenanceSyntax

Source

pub const MYSQL: Self

Available on crate feature mysql only.

The MYSQL preset for maintenance syntax.

Source§

impl MaintenanceSyntax

Source

pub const POSTGRES: Self

Available on crate feature postgres only.

The POSTGRES preset for maintenance syntax.

Source§

impl MaintenanceSyntax

Source

pub const SQLITE: Self

Available on crate feature sqlite only.

The SQLITE preset for maintenance syntax.

Trait Implementations§

Source§

impl Clone for MaintenanceSyntax

Source§

fn clone(&self) -> MaintenanceSyntax

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 MaintenanceSyntax

Source§

impl Debug for MaintenanceSyntax

Source§

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

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

impl Eq for MaintenanceSyntax

Source§

impl PartialEq for MaintenanceSyntax

Source§

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

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.