AlterTableOperation in sqlparser::ast - Rust

Enum AlterTableOperation 

Source

pub enum AlterTableOperation {
Show 52 variants AddConstraint { constraint: TableConstraint, not_valid: bool, }, 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, drop_behavior: Option<DropBehavior>, }, DropColumn { has_column_keyword: bool, column_names: Vec<Ident>, if_exists: bool, drop_behavior: Option<DropBehavior>, }, AttachPartition { partition: Partition, }, DetachPartition { partition: Partition, }, FreezePartition { partition: Partition, with_name: Option<Ident>, }, UnfreezePartition { partition: Partition, with_name: Option<Ident>, }, DropPrimaryKey { drop_behavior: Option<DropBehavior>, }, DropForeignKey { name: Ident, drop_behavior: Option<DropBehavior>, }, DropIndex { name: Ident, }, EnableAlwaysRule { name: Ident, }, EnableAlwaysTrigger { name: Ident, }, EnableReplicaRule { name: Ident, }, EnableReplicaTrigger { name: Ident, }, EnableRowLevelSecurity, ForceRowLevelSecurity, NoForceRowLevelSecurity, EnableRule { name: Ident, }, EnableTrigger { name: Ident, }, RenamePartitions { old_partitions: Vec<Expr>, new_partitions: Vec<Expr>, }, ReplicaIdentity { identity: ReplicaIdentity, }, 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: RenameTableNameKind, }, 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, }, ClusterBy { exprs: Vec<Expr>, }, DropClusteringKey, SuspendRecluster, ResumeRecluster, Refresh { subpath: Option<String>, }, Suspend, Resume, Algorithm { equals: bool, algorithm: AlterTableAlgorithm, }, Lock { equals: bool, lock: AlterTableLock, }, AutoIncrement { equals: bool, value: ValueWithSpan, }, ValidateConstraint { name: Ident, }, SetOptionsParens { options: Vec<SqlOption>, },
}
Expand description

An ALTER TABLE (Statement::AlterTable) operation

§

ADD <table_constraint> [NOT VALID]

Fields

The table constraint to add.

Whether the constraint should be marked NOT VALID.

§

ADD [COLUMN] [IF NOT EXISTS] <column_def>

Fields

§column_keyword: bool

[COLUMN].

§if_not_exists: bool

[IF NOT EXISTS]

§

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

Fields

Whether IF NOT EXISTS was specified.

Name of the projection to add.

The projection’s select clause.

§

DROP PROJECTION [IF EXISTS] name

Note: this is a ClickHouse-specific operation. Please refer to ClickHouse

Fields

Whether IF EXISTS was specified.

Name of the projection to drop.

§

MATERIALIZE PROJECTION [IF EXISTS] name [IN PARTITION partition_name]

Note: this is a ClickHouse-specific operation. Please refer to ClickHouse

Fields

Whether IF EXISTS was specified.

Name of the projection to materialize.

Optional partition name to operate on.

§

CLEAR PROJECTION [IF EXISTS] name [IN PARTITION partition_name]

Note: this is a ClickHouse-specific operation. Please refer to ClickHouse

Fields

Whether IF EXISTS was specified.

Name of the projection to clear.

Optional partition name to operate on.

§
§

DISABLE RULE rewrite_rule_name

Note: this is a PostgreSQL-specific operation.

Fields

Name of the rule to disable.

§

DISABLE TRIGGER [ trigger_name | ALL | USER ]

Note: this is a PostgreSQL-specific operation.

Fields

Name of the trigger to disable (or ALL/USER).

§

DROP CONSTRAINT [ IF EXISTS ] <name>

Fields

IF EXISTS flag for dropping the constraint.

Name of the constraint to drop.

Optional drop behavior (CASCADE/RESTRICT).

§

DROP [ COLUMN ] [ IF EXISTS ] <column_name> [ , <column_name>, ... ] [ CASCADE ]

Fields

§has_column_keyword: bool

Whether the COLUMN keyword was present.

§column_names: Vec<Ident>

Names of columns to drop.

§if_exists: bool

Whether IF EXISTS was specified for the columns.

§

ATTACH PART|PARTITION <partition_expr> Note: this is a ClickHouse-specific operation, please refer to ClickHouse

Fields

Partition expression to attach.

§

DETACH PART|PARTITION <partition_expr> Note: this is a ClickHouse-specific operation, please refer to ClickHouse

Fields

Partition expression to detach.

§

FREEZE PARTITION <partition_expr> Note: this is a ClickHouse-specific operation, please refer to ClickHouse

Fields

Optional name for the freeze operation.

§

UNFREEZE PARTITION <partition_expr> Note: this is a ClickHouse-specific operation, please refer to ClickHouse

Fields

Optional name associated with the unfreeze operation.

§

Fields

Optional drop behavior for the primary key (CASCADE/RESTRICT).

§

Fields

Foreign key symbol/name to drop.

Optional drop behavior for the foreign key.

§

DROP INDEX <index_name>

Fields

Name of the index to drop.

§

ENABLE ALWAYS RULE rewrite_rule_name

Note: this is a PostgreSQL-specific operation.

Fields

Name of the rule to enable.

§

ENABLE ALWAYS TRIGGER trigger_name

Note: this is a PostgreSQL-specific operation.

Fields

Name of the trigger to enable.

§

ENABLE REPLICA RULE rewrite_rule_name

Note: this is a PostgreSQL-specific operation.

Fields

Name of the replica rule to enable.

§

ENABLE REPLICA TRIGGER trigger_name

Note: this is a PostgreSQL-specific operation.

Fields

Name of the replica trigger to enable.

§
§
§
§

ENABLE RULE rewrite_rule_name

Note: this is a PostgreSQL-specific operation.

Fields

Name of the rule to enable.

§

ENABLE TRIGGER [ trigger_name | ALL | USER ]

Note: this is a PostgreSQL-specific operation.

Fields

Name of the trigger to enable (or ALL/USER).

§

RENAME TO PARTITION (partition=val)

Fields

Old partition expressions to be renamed.

New partition expressions corresponding to the old ones.

§

REPLICA IDENTITY { DEFAULT | USING INDEX index_name | FULL | NOTHING }

Note: this is a PostgreSQL-specific operation. Please refer to PostgreSQL documentation

Fields

Replica identity setting to apply.

§

Add Partitions

Fields

Whether IF NOT EXISTS was present when adding partitions.

§

DROP PARTITIONS ... / drop partitions from the table.

Fields

Partitions to drop (expressions).

Whether IF EXISTS was specified for dropping partitions.

§

RENAME [ COLUMN ] <old_column_name> TO <new_column_name>

Fields

§old_column_name: Ident

Existing column name to rename.

§new_column_name: Ident

New column name.

§

RENAME TO <table_name>

§

Change an existing column’s name, type, and options.

Fields

§old_name: Ident

Old column name.

§new_name: Ident

New column name.

§data_type: DataType

New data type for the column.

§

Modify an existing column’s type and options.

Fields

§col_name: Ident

Column name to modify.

§data_type: DataType

New data type for the column.

§

RENAME CONSTRAINT <old_constraint_name> TO <new_constraint_name>

Note: this is a PostgreSQL-specific operation. Rename a constraint on the table.

Fields

Existing constraint name.

§

ALTER [ COLUMN ] Alter a specific column with the provided operation.

Fields

§column_name: Ident

The column to alter.

§

Fields

§

‘SET TBLPROPERTIES ( { property_key [ = ] property_val } [, …] )’

Fields

Table properties specified as SQL options.

§

Fields

The new owner to assign to the table.

§

Fields

Expressions used for clustering the table.

§

Remove the clustering key from the table.

§

Suspend background reclustering operations.

§

Resume background reclustering operations.

§

Fields

Optional subpath for external table refresh

§
§
§

ALGORITHM [=] { DEFAULT | INSTANT | INPLACE | COPY }

MySQL-specific table alter algorithm.

Fields

Whether the = sign was used (ALGORITHM = ...).

The algorithm to use for the alter operation (MySQL-specific).

§

LOCK [=] { DEFAULT | NONE | SHARED | EXCLUSIVE }

MySQL-specific table alter lock.

Fields

Whether the = sign was used (LOCK = ...).

The locking behavior to apply (MySQL-specific).

§

AUTO_INCREMENT [=] <value>

MySQL-specific table option for raising current auto increment value.

Fields

Whether the = sign was used (AUTO_INCREMENT = ...).

Value to set for the auto-increment counter.

§

VALIDATE CONSTRAINT <name>

Fields

Name of the constraint to validate.

§

Arbitrary parenthesized SET options.

Example:

SET (scale_factor = 0.01, threshold = 500)`

PostgreSQL

Fields

Parenthesized options supplied to SET (...).

§
§
§
§
§
§