Skip to main content

CreateTableClauseSyntax

Struct CreateTableClauseSyntax 

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Accept 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§

Source§

impl CreateTableClauseSyntax

Source

pub const ANSI: Self

The ANSI predefined value.

Source§

impl CreateTableClauseSyntax

Source

pub const LENIENT: Self

Available on crate feature lenient only.

The LENIENT preset for create table clause syntax.

Source§

impl CreateTableClauseSyntax

Source

pub const MYSQL: Self

Available on crate feature mysql only.

The MYSQL preset for create table clause syntax.

Source§

impl CreateTableClauseSyntax

Source

pub const POSTGRES: Self

Available on crate feature postgres only.

The POSTGRES preset for create table clause syntax.

Source§

impl CreateTableClauseSyntax

Source

pub const SQLITE: Self

Available on crate feature sqlite only.

The SQLITE preset for create table clause syntax.

Trait Implementations§

Source§

impl Clone for CreateTableClauseSyntax

Source§

fn clone(&self) -> CreateTableClauseSyntax

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 CreateTableClauseSyntax

Source§

impl Debug for CreateTableClauseSyntax

Source§

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

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

impl Eq for CreateTableClauseSyntax

Source§

impl PartialEq for CreateTableClauseSyntax

Source§

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

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.