pub enum AlterTableOperation {
Show 35 variants
AddConstraint(TableConstraint),
AddColumn {
column_keyword: bool,
if_not_exists: bool,
column_def: ColumnDef,
column_position: Option<MySQLColumnPosition>,
},
AddProjection {
if_not_exists: bool,
name: Ident,
select: ProjectionSelect,
},
DropProjection {
if_exists: bool,
name: Ident,
},
MaterializeProjection {
if_exists: bool,
name: Ident,
partition: Option<Ident>,
},
ClearProjection {
if_exists: bool,
name: Ident,
partition: Option<Ident>,
},
DisableRowLevelSecurity,
DisableRule {
name: Ident,
},
DisableTrigger {
name: Ident,
},
DropConstraint {
if_exists: bool,
name: Ident,
cascade: bool,
},
DropColumn {
column_name: Ident,
if_exists: bool,
cascade: bool,
},
AttachPartition {
partition: Partition,
},
DetachPartition {
partition: Partition,
},
FreezePartition {
partition: Partition,
with_name: Option<Ident>,
},
UnfreezePartition {
partition: Partition,
with_name: Option<Ident>,
},
DropPrimaryKey,
EnableAlwaysRule {
name: Ident,
},
EnableAlwaysTrigger {
name: Ident,
},
EnableReplicaRule {
name: Ident,
},
EnableReplicaTrigger {
name: Ident,
},
EnableRowLevelSecurity,
EnableRule {
name: Ident,
},
EnableTrigger {
name: Ident,
},
RenamePartitions {
old_partitions: Vec<Expr>,
new_partitions: Vec<Expr>,
},
AddPartitions {
if_not_exists: bool,
new_partitions: Vec<Partition>,
},
DropPartitions {
partitions: Vec<Expr>,
if_exists: bool,
},
RenameColumn {
old_column_name: Ident,
new_column_name: Ident,
},
RenameTable {
table_name: ObjectName,
},
ChangeColumn {
old_name: Ident,
new_name: Ident,
data_type: DataType,
options: Vec<ColumnOption>,
column_position: Option<MySQLColumnPosition>,
},
ModifyColumn {
col_name: Ident,
data_type: DataType,
options: Vec<ColumnOption>,
column_position: Option<MySQLColumnPosition>,
},
RenameConstraint {
old_name: Ident,
new_name: Ident,
},
AlterColumn {
column_name: Ident,
op: AlterColumnOperation,
},
SwapWith {
table_name: ObjectName,
},
SetTblProperties {
table_properties: Vec<SqlOption>,
},
OwnerTo {
new_owner: Owner,
},
}Expand description
An ALTER TABLE (Statement::AlterTable) operation
Variants§
AddConstraint(TableConstraint)
ADD <table_constraint>
AddColumn
ADD [COLUMN] [IF NOT EXISTS] <column_def>
Fields
column_position: Option<MySQLColumnPosition>MySQL ALTER TABLE only [FIRST | AFTER column_name]
AddProjection
ADD PROJECTION [IF NOT EXISTS] name ( SELECT <COLUMN LIST EXPR> [GROUP BY] [ORDER BY])
Note: this is a ClickHouse-specific operation. Please refer to ClickHouse
DropProjection
DROP PROJECTION [IF EXISTS] name
Note: this is a ClickHouse-specific operation. Please refer to ClickHouse
MaterializeProjection
MATERIALIZE PROJECTION [IF EXISTS] name [IN PARTITION partition_name]
Note: this is a ClickHouse-specific operation. Please refer to ClickHouse
ClearProjection
CLEAR PROJECTION [IF EXISTS] name [IN PARTITION partition_name]
Note: this is a ClickHouse-specific operation. Please refer to ClickHouse
DisableRowLevelSecurity
DISABLE ROW LEVEL SECURITY
Note: this is a PostgreSQL-specific operation.
DisableRule
DISABLE RULE rewrite_rule_name
Note: this is a PostgreSQL-specific operation.
DisableTrigger
DISABLE TRIGGER [ trigger_name | ALL | USER ]
Note: this is a PostgreSQL-specific operation.
DropConstraint
DROP CONSTRAINT [ IF EXISTS ] <name>
DropColumn
DROP [ COLUMN ] [ IF EXISTS ] <column_name> [ CASCADE ]
AttachPartition
ATTACH PART|PARTITION <partition_expr>
Note: this is a ClickHouse-specific operation, please refer to
ClickHouse
DetachPartition
DETACH PART|PARTITION <partition_expr>
Note: this is a ClickHouse-specific operation, please refer to
ClickHouse
FreezePartition
FREEZE PARTITION <partition_expr>
Note: this is a ClickHouse-specific operation, please refer to
ClickHouse
UnfreezePartition
UNFREEZE PARTITION <partition_expr>
Note: this is a ClickHouse-specific operation, please refer to
ClickHouse
DropPrimaryKey
DROP PRIMARY KEY
Note: this is a MySQL-specific operation.
EnableAlwaysRule
ENABLE ALWAYS RULE rewrite_rule_name
Note: this is a PostgreSQL-specific operation.
EnableAlwaysTrigger
ENABLE ALWAYS TRIGGER trigger_name
Note: this is a PostgreSQL-specific operation.
EnableReplicaRule
ENABLE REPLICA RULE rewrite_rule_name
Note: this is a PostgreSQL-specific operation.
EnableReplicaTrigger
ENABLE REPLICA TRIGGER trigger_name
Note: this is a PostgreSQL-specific operation.
EnableRowLevelSecurity
ENABLE ROW LEVEL SECURITY
Note: this is a PostgreSQL-specific operation.
EnableRule
ENABLE RULE rewrite_rule_name
Note: this is a PostgreSQL-specific operation.
EnableTrigger
ENABLE TRIGGER [ trigger_name | ALL | USER ]
Note: this is a PostgreSQL-specific operation.
RenamePartitions
RENAME TO PARTITION (partition=val)
AddPartitions
Add Partitions
DropPartitions
RenameColumn
RENAME [ COLUMN ] <old_column_name> TO <new_column_name>
RenameTable
RENAME TO <table_name>
Fields
table_name: ObjectNameChangeColumn
Fields
options: Vec<ColumnOption>column_position: Option<MySQLColumnPosition>MySQL ALTER TABLE only [FIRST | AFTER column_name]
ModifyColumn
Fields
options: Vec<ColumnOption>column_position: Option<MySQLColumnPosition>MySQL ALTER TABLE only [FIRST | AFTER column_name]
RenameConstraint
RENAME CONSTRAINT <old_constraint_name> TO <new_constraint_name>
Note: this is a PostgreSQL-specific operation.
AlterColumn
ALTER [ COLUMN ]
SwapWith
‘SWAP WITH <table_name>’
Note: this is Snowflake specific https://docs.snowflake.com/en/sql-reference/sql/alter-table
Fields
table_name: ObjectNameSetTblProperties
‘SET TBLPROPERTIES ( { property_key [ = ] property_val } [, …] )’
OwnerTo
OWNER TO { <new_owner> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
Note: this is PostgreSQL-specific https://www.postgresql.org/docs/current/sql-altertable.html
Trait Implementations§
Source§impl Clone for AlterTableOperation
impl Clone for AlterTableOperation
Source§fn clone(&self) -> AlterTableOperation
fn clone(&self) -> AlterTableOperation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more