pub struct CreateTableClauseSyntax {Show 15 fields
pub table_options: bool,
pub without_rowid_table_option: bool,
pub strict_table_option: bool,
pub storage_parameters: bool,
pub on_commit: bool,
pub create_table_as_with_data: bool,
pub create_table_as_execute: bool,
pub declarative_partitioning: bool,
pub table_inheritance: bool,
pub like_source_table: bool,
pub statement_level_table_like: bool,
pub unlogged_tables: bool,
pub table_access_method: bool,
pub without_oids: bool,
pub typed_tables: bool,
}Expand description
Dialect-owned CREATE TABLE table-level clause syntax accepted by the parser.
The table-level decorations on a CREATE TABLE — the clauses that attach to the table
as a whole rather than to a single column or constraint. Split out of the retired
SchemaChangeSyntax at its 16-field line as the table-clause axis, distinct from the
column-definition and constraint axes. Each flag is a grammar gate: when off the clause
keyword is left unconsumed and surfaces as a clean parse error.
Fields§
§table_options: boolAccept the MySQL CREATE TABLE storage decorations: the trailing table-option
list (ENGINE = InnoDB, AUTO_INCREMENT = 100, DEFAULT CHARSET = utf8mb4,
COMMENT = '...', ROW_FORMAT = ..., COLLATE = ...) and the column-level
underscored AUTO_INCREMENT attribute.
Deliberate dual-position unit (not a MECE bug): both grammar points are one
MySQL dialect unit — MySQL always admits the column attribute wherever it admits
the table options (mirroring how existence_guards.if_exists co-gates related
sites). Splitting them would invent independent axes no shipped engine separates.
The SQLite joined AUTOINCREMENT spelling is a separate flag on
ColumnDefinitionSyntax. Not ANSI/PostgreSQL, which reject both surfaces as
leftover input.
without_rowid_table_option: boolAccept the SQLite trailing WITHOUT ROWID table option on CREATE TABLE
(CREATE TABLE t (a INTEGER PRIMARY KEY) WITHOUT ROWID), recorded as
CreateTableOptionKind::WithoutRowid.
SQLite-only; off in every other preset, where the trailing WITHOUT ROWID is left
unconsumed and surfaces as a clean parse error. Split out of
the retired sqlite_table_decorations bundle because the rowid-storage
table option is an independent grammar point from the trailing STRICT option, the
typeless column, AUTOINCREMENT, the column COLLATE, and the inline-PRIMARY KEY
ordering.
strict_table_option: boolAccept the SQLite trailing STRICT table option on CREATE TABLE
(CREATE TABLE t (a INTEGER) STRICT), recorded as
CreateTableOptionKind::Strict; the table
then enforces its declared column types instead of SQLite’s default flexible typing.
SQLite-only; off in every other preset, where the trailing STRICT is left unconsumed
and surfaces as a clean parse error. Split out of
the retired sqlite_table_decorations bundle because the strict-typing
table option is an independent grammar point from the trailing WITHOUT ROWID option,
the typeless column, AUTOINCREMENT, the column COLLATE, and the inline-PRIMARY KEY
ordering.
storage_parameters: boolAccept the CREATE TABLE … WITH ( <name> = <value>, … ) storage-parameter list
(PostgreSQL WITH (fillfactor=…); Trino/Spark WITH (format=…)). On for
ANSI/PostgreSQL/MySQL/DuckDB/Lenient. SQLite has no WITH (…) table clause, so it
is off; the WITH keyword is then not read as a table option and surfaces as a
clean parse error.
on_commit: boolAccept the temporary-table ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP }
action (SQL:1999; PostgreSQL). On for ANSI/PostgreSQL/MySQL/DuckDB/Lenient. SQLite
has no ON COMMIT table clause, so it is off; the ON keyword is then left
unconsumed and surfaces as a clean parse error.
create_table_as_with_data: boolAccept the trailing WITH [NO] DATA populate clause on CREATE TABLE … AS <query>
(and CREATE MATERIALIZED VIEW). On for ANSI/PostgreSQL/SQLite/DuckDB/Lenient. MySQL’s
CREATE TABLE … AS SELECT has no WITH [NO] DATA clause (ER_PARSE_ERROR on
mysql:8), so it is off there; the WITH keyword after the query is then left as
leftover input and surfaces as a clean parse error.
create_table_as_execute: boolAccept the PostgreSQL CREATE TABLE t [(cols)] AS EXECUTE <prepared> [(args)] [WITH [NO] DATA] form — a CTAS whose rows come from running a prepared statement. On for
PostgreSQL/Lenient. Off for ANSI/MySQL/SQLite/DuckDB (DuckDB rejects AS EXECUTE), where
the EXECUTE keyword after AS is left unconsumed and the inline-query CTAS path rejects
it as a clean parse error.
declarative_partitioning: boolAccept PostgreSQL declarative partitioning: the parent CREATE TABLE … PARTITION BY {LIST | RANGE | HASH} (<key>, …) clause, the child CREATE TABLE … PARTITION OF <parent> [(<augmentation>, …)] {FOR VALUES … | DEFAULT} body, and the ALTER TABLE … {ATTACH | DETACH} PARTITION actions. On for PostgreSQL/Lenient. Off for ANSI/MySQL/SQLite/DuckDB:
none spell this grammar (MySQL’s PARTITION BY HASH(c) PARTITIONS n and DuckDB’s
COPY-level PARTITION_BY are unrelated surfaces), so the PARTITION / ATTACH /
DETACH keyword is left unconsumed and surfaces as a clean parse error. One flag gates
the whole family — the parent spec, the child body, and the two alter actions travel
together as a single dialect unit.
table_inheritance: boolAccept the PostgreSQL INHERITS (<parent>, ...) legacy table-inheritance clause
(CREATE TABLE t (…) INHERITS (parent)). On for PostgreSQL/Lenient. Off for
ANSI/MySQL/SQLite/DuckDB — none have table inheritance (DuckDB, which otherwise inherits
the PostgreSQL schema surface, rejects it), so the INHERITS keyword is left unconsumed
and surfaces as a clean parse error.
like_source_table: boolAccept the PostgreSQL LIKE <source> [{INCLUDING | EXCLUDING} <feature> …] source-table
copy element inside the parenthesized CREATE TABLE definition list (CREATE TABLE t (LIKE src INCLUDING ALL)). On for PostgreSQL/Lenient. Off for ANSI/MySQL/SQLite/DuckDB:
DuckDB rejects the element form, and MySQL’s CREATE TABLE t LIKE src is a distinct
statement-level production (no parentheses), not this element — so when off, a LIKE at
an element position surfaces as a clean parse error.
statement_level_table_like: boolAccept MySQL’s statement-level CREATE TABLE t LIKE <source> table-clone body and its
parenthesized twin CREATE TABLE t (LIKE <source>) — a whole-statement production that
copies an existing table’s definition, distinct from the PostgreSQL copy element gated
by like_source_table. The source is a single bare (qualified)
name: no {INCLUDING | EXCLUDING} <feature> options, no co-element, no trailing table
options (LIKE src ENGINE=…, (LIKE src, x INT), (LIKE src INCLUDING ALL) are all
ER_PARSE_ERROR on mysql:8.4). On for MySQL/Lenient. Off for ANSI/PostgreSQL/SQLite/
DuckDB, where a LIKE after the table name (or as the first token inside () is left
unconsumed and surfaces as a clean parse error — PostgreSQL rejects the bare form at raw
parse, and only reads (LIKE src …) as the element form above. When both this and
like_source_table are on (Lenient), the parenthesized (LIKE …) reads as the more general PostgreSQL element (a superset that also admits the feature
options), so this flag governs only the bare form there; MySQL, with the element flag off,
takes both spellings onto this body.
unlogged_tables: boolAccept CREATE UNLOGGED TABLE — the non-WAL-logged persistence keyword. On for
PostgreSQL/DuckDB/Lenient (DuckDB parses it as a no-op). Off for ANSI/MySQL/SQLite, where
UNLOGGED after CREATE is left unconsumed and surfaces as a clean parse error. In
PostgreSQL’s grammar UNLOGGED is a peer of TEMP/TEMPORARY, so the two are mutually
exclusive; the parser rejects CREATE TEMP UNLOGGED TABLE accordingly.
table_access_method: boolAccept the trailing USING <access_method> table access-method clause (PostgreSQL
CREATE TABLE … USING heap). On for PostgreSQL/Lenient. Off for ANSI/MySQL/SQLite/DuckDB
(DuckDB has no pluggable table access methods), where the USING keyword after the table
body is left unconsumed and surfaces as a clean parse error. Distinct from the CREATE
INDEX USING <method> clause gated by index_using_method.
without_oids: boolAccept the legacy WITHOUT OIDS trailing option (PostgreSQL) — kept as an accepted
no-op. On for PostgreSQL/Lenient. Off for ANSI/MySQL/SQLite/DuckDB, where the WITHOUT
keyword (absent SQLite’s WITHOUT ROWID, a separate
without_rowid_table_option option) is left unconsumed
and surfaces as a clean parse error.
typed_tables: boolAccept the CREATE TABLE t OF <type> [(…)] typed-table form (PostgreSQL): the table’s
column shape is drawn from a composite type. On for PostgreSQL/Lenient. Off for
ANSI/MySQL/SQLite/DuckDB, where OF after the table name is left unconsumed and surfaces
as a clean parse error.
Implementations§
Trait Implementations§
Source§impl Clone for CreateTableClauseSyntax
impl Clone for CreateTableClauseSyntax
Source§fn clone(&self) -> CreateTableClauseSyntax
fn clone(&self) -> CreateTableClauseSyntax
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more