pub enum ColumnOption {
Show 23 variants
Null,
NotNull,
Default(Expr),
Materialized(Expr),
Ephemeral(Option<Expr>),
Alias(Expr),
PrimaryKey(PrimaryKeyConstraint),
Unique(UniqueConstraint),
ForeignKey(ForeignKeyConstraint),
Check(CheckConstraint),
DialectSpecific(Vec<Token>),
CharacterSet(ObjectName),
Collation(ObjectName),
Comment(String),
OnUpdate(Expr),
Generated {
generated_as: GeneratedAs,
sequence_options: Option<Vec<SequenceOptions>>,
generation_expr: Option<Expr>,
generation_expr_mode: Option<GeneratedExpressionMode>,
generated_keyword: bool,
},
Options(Vec<SqlOption>),
Identity(IdentityPropertyKind),
OnConflict(Keyword),
Policy(ColumnPolicy),
Tags(TagsColumnOption),
Srid(Box<Expr>),
Invisible,
}Expand description
ColumnOptions are modifiers that follow a column definition in a CREATE TABLE statement.
NULL
NOT NULL
DEFAULT <restricted-expr>
MATERIALIZE <expr>
Syntax: b INT MATERIALIZE (a + 1)
PRIMARY KEY [<constraint_characteristics>]
UNIQUE [<constraint_characteristics>]
A referential integrity constraint (REFERENCES <foreign_table> (<referred_columns>) [ MATCH { FULL | PARTIAL | SIMPLE } ] { [ON DELETE <referential_action>] [ON UPDATE <referential_action>] | [ON UPDATE <referential_action>] [ON DELETE <referential_action>] } [<constraint_characteristics>] ).
CHECK (<expr>)
Dialect-specific options, such as:
- MySQL’s
AUTO_INCREMENTor SQLite’sAUTOINCREMENT - …
CHARACTER SET <name> column option
COLLATE <name> column option
COMMENT '<text>' column option
ON UPDATE <expr> column option
Generateds are modifiers that follow a column definition in a CREATE TABLE statement.
Fields
How the column is generated (e.g. GENERATED ALWAYS, BY DEFAULT, or expression-stored).
Sequence/identity options when generation is backed by a sequence.
Optional expression used to generate the column value.
Mode of the generated expression (VIRTUAL or STORED) when generation_expr is present.
false if ‘GENERATED ALWAYS’ is skipped (option starts with AS)
BigQuery specific: Explicit column options in a view 1 or table 2 Syntax
OPTIONS(description="field desc")Creates an identity or an autoincrement column in a table. Syntax
{ IDENTITY | AUTOINCREMENT } [ (seed , increment) | START num INCREMENT num ] [ ORDER | NOORDER ]Snowflake specific: an option of specifying security masking or projection policy to set on a column. Syntax:
[ WITH ] MASKING POLICY <policy_name> [ USING ( <col_name> , <cond_col1> , ... ) ]
[ WITH ] PROJECTION POLICY <policy_name>Snowflake specific: Specifies the tag name and the tag string value. Syntax:
[ WITH ] TAG ( <tag_name> = '<tag_value>' [ , <tag_name> = '<tag_value>' , ... ] )MySQL specific: Spatial reference identifier Syntax:
CREATE TABLE geom (g GEOMETRY NOT NULL SRID 4326);MySQL specific: Column is invisible via SELECT * Syntax:
CREATE TABLE t (foo INT, bar INT INVISIBLE);