pub struct ColumnDef<X: Extension = NoExt> {
pub name: Ident,
pub data_type: Option<DataType<X>>,
pub storage: Option<Box<Ident>>,
pub compression: Option<Box<Ident>>,
pub constraints: ThinVec<ColumnConstraint<X>>,
pub meta: Meta,
}Expand description
An SQL column def.
Fields§
§name: IdentName referenced by this syntax.
data_type: Option<DataType<X>>The column’s declared type, or None for a SQLite typeless column
(CREATE TABLE t (a, b)): SQLite’s flexible typing lets a column omit its
type entirely (the column then takes BLOB affinity). Every other dialect
requires a type, so the omission is gated for acceptance by
ColumnDefinitionSyntax::typeless_column_definitions
— off elsewhere, where a missing type surfaces as a clean parse error. The
omitted and written forms round-trip distinctly (an Option, not a synthesized
default), so a downstream converter sees exactly what the source declared.
storage: Option<Box<Ident>>The per-column STORAGE {<strategy> | DEFAULT} clause (PostgreSQL): the column’s
on-disk storage strategy (PLAIN / EXTERNAL / EXTENDED / MAIN, or the DEFAULT
keyword). It is a fixed-position clause in PostgreSQL’s columnDef grammar — after the
type and before both compression and the
constraints (ColId Typename [STORAGE …] [COMPRESSION …] ColQualList) — so a STORAGE after a constraint, or after COMPRESSION, is a
raw-parse error. The value is an open name, not a closed enum: PostgreSQL’s grammar is
STORAGE {ColId | DEFAULT} and validates the strategy word at analysis, out of this
parser’s layer (STORAGE bogus is engine-measured accepted at raw parse), so any single
(optionally quoted) identifier — or the DEFAULT keyword, interned as written — rides
here as an Ident, boxed as the cold clause it is (see
compression). None when unwritten. Gated for acceptance by
ColumnDefinitionSyntax::column_storage — off
elsewhere, where the STORAGE keyword surfaces as a clean parse error.
compression: Option<Box<Ident>>The per-column COMPRESSION <method> clause (PostgreSQL): the compression method for the
column’s TOAST-able values (pglz, lz4, or the DEFAULT keyword). Like
storage a fixed-position clause with the same open
{ColId | DEFAULT} value grammar — after the type and storage, before
the constraints — so a COMPRESSION after a constraint or before
STORAGE is a raw-parse error, while a qualified schema.method is one too (the value
is a single identifier). PostgreSQL validates the specific method name at a later stage,
out of this parser’s layer. None when unwritten. The name is boxed to keep this cold
clause from widening the warm, vec-embedded ColumnDef (the box/inline budget — a wide
table holds many ColumnDefs and COMPRESSION is rarely written). Gated for acceptance
by the same ColumnDefinitionSyntax::column_storage
flag as STORAGE (the two physical-storage attributes travel together).
constraints: ThinVec<ColumnConstraint<X>>constraints in source order.
meta: MetaSource location and node identity.
Trait Implementations§
Source§impl<'de, X> Deserialize<'de> for ColumnDef<X>where
X: Deserialize<'de> + Extension,
impl<'de, X> Deserialize<'de> for ColumnDef<X>where
X: Deserialize<'de> + Extension,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<X: Eq + Extension> Eq for ColumnDef<X>
Source§impl<X: Extension + Render> Render for ColumnDef<X>
impl<X: Extension + Render> Render for ColumnDef<X>
Source§fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result
fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result
Source§fn operand_binding_power(&self) -> Option<BindingPower>
fn operand_binding_power(&self) -> Option<BindingPower>
None (the default) for a self-delimiting node — an atom, call, or
constructor — that never needs parentheses. Read moreimpl<X: PartialEq + Extension> StructuralPartialEq for ColumnDef<X>
Auto Trait Implementations§
impl<X> Freeze for ColumnDef<X>where
X: Freeze,
impl<X> RefUnwindSafe for ColumnDef<X>where
X: RefUnwindSafe,
impl<X> Send for ColumnDef<X>where
X: Send,
impl<X> Sync for ColumnDef<X>where
X: Sync,
impl<X> Unpin for ColumnDef<X>where
X: Unpin,
impl<X> UnsafeUnpin for ColumnDef<X>where
X: UnsafeUnpin,
impl<X> UnwindSafe for ColumnDef<X>where
X: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DynAstExt for T
impl<T> DynAstExt for T
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&dyn Any for downcasting a node back to its concrete type.Source§fn dyn_clone(&self) -> Box<dyn DynAstExt>
fn dyn_clone(&self) -> Box<dyn DynAstExt>
Clone (whose
Self-returning signature cannot go through a vtable).Source§fn dyn_eq(&self, other: &dyn DynAstExt) -> bool
fn dyn_eq(&self, other: &dyn DynAstExt) -> bool
PartialEq (whose &Self argument cannot go through a vtable). Equal
iff other holds the same concrete type and that type deems the values
equal; differently-typed nodes are never equal.