MySQL  8.0.16
Source Code Documentation
Alter_info Class Reference

Data describing the table being created by CREATE TABLE or altered by ALTER TABLE. More...

#include <sql_alter.h>

Public Types

enum  Alter_info_flag : ulonglong {
  ALTER_ADD_COLUMN = 1ULL << 0, ALTER_DROP_COLUMN = 1ULL << 1, ALTER_CHANGE_COLUMN = 1ULL << 2, ALTER_ADD_INDEX = 1ULL << 3,
  ALTER_DROP_INDEX = 1ULL << 4, ALTER_RENAME = 1ULL << 5, ALTER_ORDER = 1ULL << 6, ALTER_OPTIONS = 1ULL << 7,
  ALTER_CHANGE_COLUMN_DEFAULT = 1ULL << 8, ALTER_KEYS_ONOFF = 1ULL << 9, ALTER_RECREATE = 1ULL << 10, ALTER_ADD_PARTITION = 1ULL << 11,
  ALTER_DROP_PARTITION = 1ULL << 12, ALTER_COALESCE_PARTITION = 1ULL << 13, ALTER_REORGANIZE_PARTITION = 1ULL << 14, ALTER_PARTITION = 1ULL << 15,
  ALTER_ADMIN_PARTITION = 1ULL << 16, ALTER_TABLE_REORG = 1ULL << 17, ALTER_REBUILD_PARTITION = 1ULL << 18, ALTER_ALL_PARTITION = 1ULL << 19,
  ALTER_REMOVE_PARTITIONING = 1ULL << 20, ADD_FOREIGN_KEY = 1ULL << 21, DROP_FOREIGN_KEY = 1ULL << 22, ALTER_EXCHANGE_PARTITION = 1ULL << 23,
  ALTER_TRUNCATE_PARTITION = 1ULL << 24, ALTER_COLUMN_ORDER = 1ULL << 25, ALTER_RENAME_INDEX = 1ULL << 26, ALTER_DISCARD_TABLESPACE = 1ULL << 27,
  ALTER_IMPORT_TABLESPACE = 1ULL << 28, ALTER_INDEX_VISIBILITY = 1ULL << 29, ALTER_SECONDARY_LOAD = 1ULL << 30, ALTER_SECONDARY_UNLOAD = 1ULL << 31,
  ADD_CHECK_CONSTRAINT = 1ULL << 32, DROP_CHECK_CONSTRAINT = 1ULL << 33, ENFORCE_CHECK_CONSTRAINT = 1ULL << 34, SUSPEND_CHECK_CONSTRAINT = 1ULL << 35
}
 
enum  enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE }
 
enum  enum_alter_table_algorithm { ALTER_TABLE_ALGORITHM_DEFAULT, ALTER_TABLE_ALGORITHM_INPLACE, ALTER_TABLE_ALGORITHM_INSTANT, ALTER_TABLE_ALGORITHM_COPY }
 The different values of the ALGORITHM clause. More...
 
enum  enum_alter_table_lock { ALTER_TABLE_LOCK_DEFAULT, ALTER_TABLE_LOCK_NONE, ALTER_TABLE_LOCK_SHARED, ALTER_TABLE_LOCK_EXCLUSIVE }
 The different values of the LOCK clause. More...
 
enum  enum_with_validation { ALTER_VALIDATION_DEFAULT, ALTER_WITH_VALIDATION, ALTER_WITHOUT_VALIDATION }
 Status of validation clause in ALTER TABLE statement. More...
 

Public Member Functions

 Alter_info (MEM_ROOT *mem_root)
 
 Alter_info (const Alter_info &rhs, MEM_ROOT *mem_root)
 Construct a copy of this object to be used for mysql_alter_table and mysql_create_table. More...
 
bool add_field (THD *thd, const LEX_STRING *field_name, enum enum_field_types type, const char *length, const char *decimal, uint type_modifier, Item *default_value, Item *on_update_value, LEX_STRING *comment, const char *change, List< String > *interval_list, const CHARSET_INFO *cs, bool has_explicit_collation, uint uint_geom_type, Value_generator *gcol_info, Value_generator *default_val_expr, const char *opt_after, Nullable< gis::srid_t > srid, Sql_check_constraint_spec_list *check_cons_list, dd::Column::enum_hidden_type hidden)
 Store field definition for create. More...
 

Public Attributes

Mem_root_array< const Alter_drop * > drop_list
 Columns and keys to be dropped. More...
 
Mem_root_array< const Alter_column * > alter_list
 
Mem_root_array< Key_spec * > key_list
 
Mem_root_array< const Alter_rename_key * > alter_rename_key_list
 
Mem_root_array< const Alter_index_visibility * > alter_index_visibility_list
 Indexes whose visibilities are to be changed. More...
 
Mem_root_array< const Alter_state * > alter_state_list
 List of check constraints whose state is changed. More...
 
Sql_check_constraint_spec_list check_constraint_spec_list
 Check constraints specification for CREATE and ALTER TABLE operations. More...
 
List< Create_fieldcreate_list
 
ulonglong flags
 
enum_enable_or_disable keys_onoff
 
List< Stringpartition_names
 
uint num_parts
 
enum_alter_table_algorithm requested_algorithm
 
enum_alter_table_lock requested_lock
 
enum_with_validation with_validation
 
LEX_CSTRING new_db_name
 "new_db" (if any) or "db" (if any) or default database from ALTER TABLE [db. More...
 
LEX_CSTRING new_table_name
 New table name in the "RENAME [TO] <table_name>" clause or NULL_STR. More...
 

Private Member Functions

Alter_infooperator= (const Alter_info &rhs)
 
 Alter_info (const Alter_info &rhs)
 

Detailed Description

Data describing the table being created by CREATE TABLE or altered by ALTER TABLE.

Member Enumeration Documentation

◆ Alter_info_flag

Enumerator
ALTER_ADD_COLUMN 

Set for ADD [COLUMN].

ALTER_DROP_COLUMN 

Set for DROP [COLUMN].

ALTER_CHANGE_COLUMN 

Set for CHANGE [COLUMN] | MODIFY [CHANGE] Set by mysql_recreate_table()

ALTER_ADD_INDEX 

Set for ADD INDEX | ADD KEY | ADD PRIMARY KEY | ADD UNIQUE KEY | ADD UNIQUE INDEX | ALTER ADD [COLUMN].

ALTER_DROP_INDEX 

Set for DROP PRIMARY KEY | DROP FOREIGN KEY | DROP KEY | DROP INDEX.

ALTER_RENAME 

Set for RENAME [TO].

ALTER_ORDER 

Set for ORDER BY.

ALTER_OPTIONS 

Set for table_options.

ALTER_CHANGE_COLUMN_DEFAULT 

Set for ALTER [COLUMN] ... SET DEFAULT ... | DROP DEFAULT.

ALTER_KEYS_ONOFF 

Set for DISABLE KEYS | ENABLE KEYS.

ALTER_RECREATE 

Set for FORCE Set for ENGINE(same engine) Set by mysql_recreate_table()

ALTER_ADD_PARTITION 

Set for ADD PARTITION.

ALTER_DROP_PARTITION 

Set for DROP PARTITION.

ALTER_COALESCE_PARTITION 

Set for COALESCE PARTITION.

ALTER_REORGANIZE_PARTITION 

Set for REORGANIZE PARTITION ... INTO.

ALTER_PARTITION 

Set for partition_options.

ALTER_ADMIN_PARTITION 

Set for LOAD INDEX INTO CACHE ...

PARTITION Set for CACHE INDEX ... PARTITION

ALTER_TABLE_REORG 

Set for REORGANIZE PARTITION.

ALTER_REBUILD_PARTITION 

Set for REBUILD PARTITION.

ALTER_ALL_PARTITION 

Set for partitioning operations specifying ALL keyword.

ALTER_REMOVE_PARTITIONING 

Set for REMOVE PARTITIONING.

ADD_FOREIGN_KEY 

Set for ADD FOREIGN KEY.

DROP_FOREIGN_KEY 

Set for DROP FOREIGN KEY.

ALTER_EXCHANGE_PARTITION 

Set for EXCHANGE PARITION.

ALTER_TRUNCATE_PARTITION 

Set by Sql_cmd_alter_table_truncate_partition::execute()

ALTER_COLUMN_ORDER 

Set for ADD [COLUMN] FIRST | AFTER.

ALTER_RENAME_INDEX 

Set for RENAME INDEX.

ALTER_DISCARD_TABLESPACE 

Set for discarding the tablespace.

ALTER_IMPORT_TABLESPACE 

Set for importing the tablespace.

ALTER_INDEX_VISIBILITY 

Means that the visibility of an index is changed.

ALTER_SECONDARY_LOAD 

Set for SECONDARY LOAD.

ALTER_SECONDARY_UNLOAD 

Set for SECONDARY UNLOAD.

ADD_CHECK_CONSTRAINT 

Set for add check constraint.

DROP_CHECK_CONSTRAINT 

Set for drop check constraint.

ENFORCE_CHECK_CONSTRAINT 

Set for check constraint enforce.

SUSPEND_CHECK_CONSTRAINT 

Set for check constraint suspend.

◆ enum_alter_table_algorithm

The different values of the ALGORITHM clause.

Describes which algorithm to use when altering the table.

Enumerator
ALTER_TABLE_ALGORITHM_DEFAULT 
ALTER_TABLE_ALGORITHM_INPLACE 
ALTER_TABLE_ALGORITHM_INSTANT 
ALTER_TABLE_ALGORITHM_COPY 

◆ enum_alter_table_lock

The different values of the LOCK clause.

Describes the level of concurrency during ALTER TABLE.

Enumerator
ALTER_TABLE_LOCK_DEFAULT 
ALTER_TABLE_LOCK_NONE 
ALTER_TABLE_LOCK_SHARED 
ALTER_TABLE_LOCK_EXCLUSIVE 

◆ enum_enable_or_disable

Enumerator
LEAVE_AS_IS 
ENABLE 
DISABLE 

◆ enum_with_validation

Status of validation clause in ALTER TABLE statement.

Used during partitions and GC alterations.

Enumerator
ALTER_VALIDATION_DEFAULT 

Default value, used when it's not specified in the statement.

Means WITH VALIDATION for partitions alterations and WITHOUT VALIDATION for altering virtual GC.

ALTER_WITH_VALIDATION 
ALTER_WITHOUT_VALIDATION 

Constructor & Destructor Documentation

◆ Alter_info() [1/3]

Alter_info::Alter_info ( MEM_ROOT mem_root)
inlineexplicit

◆ Alter_info() [2/3]

Alter_info::Alter_info ( const Alter_info rhs,
MEM_ROOT mem_root 
)

Construct a copy of this object to be used for mysql_alter_table and mysql_create_table.

Historically, these two functions modify their Alter_info arguments. This behaviour breaks re-execution of prepared statements and stored procedures and is compensated by always supplying a copy of Alter_info to these functions.

Parameters
rhsAlter_info to make copy of
mem_rootMem_root for new Alter_info
Note
You need to use check the error in THD for out of memory condition after calling this function.

◆ Alter_info() [3/3]

Alter_info::Alter_info ( const Alter_info rhs)
private

Member Function Documentation

◆ operator=()

Alter_info& Alter_info::operator= ( const Alter_info rhs)
private

Member Data Documentation

◆ alter_index_visibility_list

Mem_root_array<const Alter_index_visibility *> Alter_info::alter_index_visibility_list

Indexes whose visibilities are to be changed.

◆ alter_list

Mem_root_array<const Alter_column *> Alter_info::alter_list

◆ alter_rename_key_list

Mem_root_array<const Alter_rename_key *> Alter_info::alter_rename_key_list

◆ alter_state_list

Mem_root_array<const Alter_state *> Alter_info::alter_state_list

List of check constraints whose state is changed.

◆ check_constraint_spec_list

Sql_check_constraint_spec_list Alter_info::check_constraint_spec_list

Check constraints specification for CREATE and ALTER TABLE operations.

◆ create_list

List<Create_field> Alter_info::create_list

◆ drop_list

Mem_root_array<const Alter_drop *> Alter_info::drop_list

Columns and keys to be dropped.

After mysql_prepare_alter_table() it contains only foreign keys and virtual generated columns to be dropped. This information is necessary for the storage engine to do in-place alter.

◆ flags

ulonglong Alter_info::flags

◆ key_list

Mem_root_array<Key_spec *> Alter_info::key_list

◆ keys_onoff

enum_enable_or_disable Alter_info::keys_onoff

◆ new_db_name

LEX_CSTRING Alter_info::new_db_name

"new_db" (if any) or "db" (if any) or default database from ALTER TABLE [db.

]table [ RENAME [TO|AS|=] [new_db.]new_table ]

◆ new_table_name

LEX_CSTRING Alter_info::new_table_name

New table name in the "RENAME [TO] <table_name>" clause or NULL_STR.

◆ num_parts

uint Alter_info::num_parts

◆ partition_names

List<String> Alter_info::partition_names

◆ requested_algorithm

enum_alter_table_algorithm Alter_info::requested_algorithm

◆ requested_lock

enum_alter_table_lock Alter_info::requested_lock

◆ with_validation

enum_with_validation Alter_info::with_validation

The documentation for this class was generated from the following files: