MCPcopy Create free account
hub / github.com/MariaDB/server / mysql_prepare_alter_table

Function mysql_prepare_alter_table

sql/sql_table.cc:8544–9639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8542*/
8543
8544bool
8545mysql_prepare_alter_table(THD *thd, TABLE *table,
8546 Table_specification_st *create_info,
8547 Alter_info *alter_info,
8548 Alter_table_ctx *alter_ctx)
8549{
8550 /* New column definitions are added here */
8551 List<Create_field> new_create_list;
8552 /* System-invisible fields must be added last */
8553 List<Create_field> new_create_tail;
8554 /* New key definitions are added here */
8555 List<Key> new_key_list;
8556 List<FOREIGN_KEY_INFO> fk_list;
8557 List<Alter_rename_key> rename_key_list(alter_info->alter_rename_key_list);
8558 MEM_ROOT *root= thd->mem_root;
8559
8560 /*
8561 Create a deep copy of the list of visibility for indexes, as it will be
8562 altered here.
8563 */
8564 List<Alter_index_ignorability>
8565 alter_index_ignorability_list(alter_info->alter_index_ignorability_list,
8566 root);
8567
8568 list_copy_and_replace_each_value(alter_index_ignorability_list, root);
8569
8570 List_iterator<Alter_drop> drop_it(alter_info->drop_list);
8571 List_iterator<Create_field> def_it(alter_info->create_list);
8572 List_iterator<Alter_column> alter_it(alter_info->alter_list);
8573 List_iterator<Key> key_it(alter_info->key_list);
8574 List_iterator<Create_field> find_it(new_create_list);
8575 List_iterator<Create_field> field_it(new_create_list);
8576 List<Key_part_spec> key_parts;
8577 List<Virtual_column_info> new_constraint_list;
8578 uint db_create_options= (table->s->db_create_options
8579 & ~(HA_OPTION_PACK_RECORD));
8580 Item::func_processor_rename column_rename_param;
8581 uint used_fields, dropped_sys_vers_fields= 0;
8582 KEY *key_info=table->key_info;
8583 bool rc= TRUE;
8584 bool vers_system_invisible= false;
8585 Create_field *def;
8586 Field **f_ptr,*field;
8587 MY_BITMAP *dropped_fields= NULL; // if it's NULL - no dropped fields
8588 bool drop_period= false;
8589 Lex_ident_column period_start_name;
8590 Lex_ident_column period_end_name;
8591 DBUG_ENTER("mysql_prepare_alter_table");
8592
8593 if (table->s->period.name)
8594 {
8595 period_start_name= table->s->period_start_field()->field_name;
8596 period_end_name= table->s->period_end_field()->field_name;
8597 }
8598
8599 /*
8600 Merge incompatible changes flag in case of upgrade of a table from an
8601 old MariaDB or MySQL version. This ensures that we don't try to do an

Callers 4

vers_create_partitionsFunction · 0.85
mysql_create_like_tableFunction · 0.85
mysql_alter_tableFunction · 0.85

Calls 15

merge_engine_optionsFunction · 0.85
bitmap_set_bitFunction · 0.85
my_errorFunction · 0.85
append_drop_columnFunction · 0.85
Lex_ident_columnClass · 0.85
rename_field_in_listFunction · 0.85
my_messageFunction · 0.85
setup_keyinfo_hashFunction · 0.85
blob_length_by_typeFunction · 0.85
re_setup_keyinfo_hashFunction · 0.85
DDL_optionsClass · 0.85

Tested by

no test coverage detected