pub enum TableConstraint {
PrimaryKey {
name: Option<Identifier>,
columns: Vec<Identifier>,
include_columns: Vec<Identifier>,
modifiers: ConstraintModifiers,
has_constraint_keyword: bool,
},
Unique {
name: Option<Identifier>,
columns: Vec<Identifier>,
columns_parenthesized: bool,
modifiers: ConstraintModifiers,
has_constraint_keyword: bool,
nulls_not_distinct: bool,
},
ForeignKey {
name: Option<Identifier>,
columns: Vec<Identifier>,
references: Option<ForeignKeyRef>,
on_delete: Option<ReferentialAction>,
on_update: Option<ReferentialAction>,
modifiers: ConstraintModifiers,
},
Check {
name: Option<Identifier>,
expression: Expression,
modifiers: ConstraintModifiers,
},
Index {
name: Option<Identifier>,
columns: Vec<Identifier>,
kind: Option<String>,
modifiers: ConstraintModifiers,
use_key_keyword: bool,
expression: Option<Box<Expression>>,
index_type: Option<Box<Expression>>,
granularity: Option<Box<Expression>>,
},
Projection {
name: Identifier,
expression: Expression,
},
Like {
source: TableRef,
options: Vec<(LikeOptionAction, String)>,
},
PeriodForSystemTime {
start_col: Identifier,
end_col: Identifier,
},
Exclude {
name: Option<Identifier>,
using: Option<String>,
elements: Vec<ExcludeElement>,
include_columns: Vec<Identifier>,
where_clause: Option<Box<Expression>>,
with_params: Vec<(String, String)>,
using_index_tablespace: Option<String>,
modifiers: ConstraintModifiers,
},
Tags(Tags),
InitiallyDeferred {
deferred: bool,
},
}Expand description
Table-level constraint
Variants§
PrimaryKey
Fields
name: Option<Identifier>columns: Vec<Identifier>include_columns: Vec<Identifier>INCLUDE (columns) - non-key columns included in the index (PostgreSQL)
modifiers: ConstraintModifiersUnique
Fields
name: Option<Identifier>columns: Vec<Identifier>columns_parenthesized: boolWhether columns are parenthesized (false for UNIQUE idx_name without parens)
modifiers: ConstraintModifiersForeignKey
Fields
name: Option<Identifier>columns: Vec<Identifier>references: Option<ForeignKeyRef>on_delete: Option<ReferentialAction>ON DELETE action when REFERENCES is absent
on_update: Option<ReferentialAction>ON UPDATE action when REFERENCES is absent
modifiers: ConstraintModifiersCheck
Index
INDEX / KEY constraint (MySQL)
Fields
name: Option<Identifier>columns: Vec<Identifier>modifiers: ConstraintModifiersexpression: Option<Box<Expression>>ClickHouse: indexed expression (instead of columns)
index_type: Option<Box<Expression>>ClickHouse: TYPE type_func(args)
granularity: Option<Box<Expression>>ClickHouse: GRANULARITY n
Projection
ClickHouse PROJECTION definition
Like
PostgreSQL LIKE clause: LIKE source_table [INCLUDING|EXCLUDING options]
Fields
options: Vec<(LikeOptionAction, String)>Options as (INCLUDING|EXCLUDING, property) pairs
PeriodForSystemTime
TSQL PERIOD FOR SYSTEM_TIME (start_col, end_col)
Exclude
PostgreSQL EXCLUDE constraint EXCLUDE [USING method] (element WITH operator, …) [INCLUDE (cols)] [WHERE (expr)] [WITH (params)]
Fields
name: Option<Identifier>elements: Vec<ExcludeElement>Elements: (expression, operator) pairs
include_columns: Vec<Identifier>INCLUDE columns
where_clause: Option<Box<Expression>>WHERE predicate
modifiers: ConstraintModifiersTags(Tags)
Snowflake TAG clause: TAG (key=‘value’, key2=‘value2’)
InitiallyDeferred
PostgreSQL table-level INITIALLY DEFERRED/INITIALLY IMMEDIATE This is a standalone clause at the end of the CREATE TABLE that sets the default for all deferrable constraints in the table
Trait Implementations§
Source§impl Clone for TableConstraint
impl Clone for TableConstraint
Source§fn clone(&self) -> TableConstraint
fn clone(&self) -> TableConstraint
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more