Struct sqlparser::ast::ColumnOptionDef
source · pub struct ColumnOptionDef {
pub name: Option<Located<Ident>>,
pub option: ColumnOption,
}
Expand description
An optionally-named ColumnOption
: [ CONSTRAINT <name> ] <column-option>
.
Note that implementations are substantially more permissive than the ANSI
specification on what order column options can be presented in, and whether
they are allowed to be named. The specification distinguishes between
constraints (NOT NULL, UNIQUE, PRIMARY KEY, and CHECK), which can be named
and can appear in any order, and other options (DEFAULT, GENERATED), which
cannot be named and must appear in a fixed order. PostgreSQL
, however,
allows preceding any option with CONSTRAINT <name>
, even those that are
not really constraints, like NULL and DEFAULT. MSSQL is less permissive,
allowing DEFAULT, UNIQUE, PRIMARY KEY and CHECK to be named, but not NULL or
NOT NULL constraints (the last of which is in violation of the spec).
For maximum flexibility, we don’t distinguish between constraint and non-constraint options, lumping them all together under the umbrella of “column options,” and we allow any column option to be named.
Fields§
§name: Option<Located<Ident>>
§option: ColumnOption
Trait Implementations§
source§impl Clone for ColumnOptionDef
impl Clone for ColumnOptionDef
source§fn clone(&self) -> ColumnOptionDef
fn clone(&self) -> ColumnOptionDef
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ColumnOptionDef
impl Debug for ColumnOptionDef
source§impl<'de> Deserialize<'de> for ColumnOptionDef
impl<'de> Deserialize<'de> for ColumnOptionDef
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>,
source§impl Display for ColumnOptionDef
impl Display for ColumnOptionDef
source§impl Hash for ColumnOptionDef
impl Hash for ColumnOptionDef
source§impl Ord for ColumnOptionDef
impl Ord for ColumnOptionDef
source§fn cmp(&self, other: &ColumnOptionDef) -> Ordering
fn cmp(&self, other: &ColumnOptionDef) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<ColumnOptionDef> for ColumnOptionDef
impl PartialEq<ColumnOptionDef> for ColumnOptionDef
source§fn eq(&self, other: &ColumnOptionDef) -> bool
fn eq(&self, other: &ColumnOptionDef) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<ColumnOptionDef> for ColumnOptionDef
impl PartialOrd<ColumnOptionDef> for ColumnOptionDef
source§fn partial_cmp(&self, other: &ColumnOptionDef) -> Option<Ordering>
fn partial_cmp(&self, other: &ColumnOptionDef) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more