mirror of
https://github.com/MariaDB/server.git
synced 2025-08-05 13:16:09 +03:00
Merge 10.11 into 11.0
This commit is contained in:
@@ -6602,8 +6602,6 @@ static KEY *find_key_ci(const char *key_name, KEY *key_start, KEY *key_end)
|
||||
|
||||
@param thd Thread
|
||||
@param table The original table.
|
||||
@param varchar Indicates that new definition has new
|
||||
VARCHAR column.
|
||||
@param[in/out] ha_alter_info Data structure which already contains
|
||||
basic information about create options,
|
||||
field and keys for the new version of
|
||||
@@ -6638,7 +6636,7 @@ static KEY *find_key_ci(const char *key_name, KEY *key_start, KEY *key_end)
|
||||
@retval false success
|
||||
*/
|
||||
|
||||
static bool fill_alter_inplace_info(THD *thd, TABLE *table, bool varchar,
|
||||
static bool fill_alter_inplace_info(THD *thd, TABLE *table,
|
||||
Alter_inplace_info *ha_alter_info)
|
||||
{
|
||||
Field **f_ptr, *field;
|
||||
@@ -6688,13 +6686,6 @@ static bool fill_alter_inplace_info(THD *thd, TABLE *table, bool varchar,
|
||||
if (alter_info->flags & ALTER_CHANGE_COLUMN)
|
||||
ha_alter_info->handler_flags|= ALTER_COLUMN_DEFAULT;
|
||||
|
||||
/*
|
||||
If we altering table with old VARCHAR fields we will be automatically
|
||||
upgrading VARCHAR column types.
|
||||
*/
|
||||
if (table->s->frm_version < FRM_VER_TRUE_VARCHAR && varchar)
|
||||
ha_alter_info->handler_flags|= ALTER_STORED_COLUMN_TYPE;
|
||||
|
||||
DBUG_PRINT("info", ("handler_flags: %llu", ha_alter_info->handler_flags));
|
||||
|
||||
/*
|
||||
@@ -6736,6 +6727,30 @@ static bool fill_alter_inplace_info(THD *thd, TABLE *table, bool varchar,
|
||||
Check if type of column has changed.
|
||||
*/
|
||||
bool is_equal= field->is_equal(*new_field);
|
||||
|
||||
if (is_equal)
|
||||
{
|
||||
const Type_handler *th= field->type_handler();
|
||||
if (th != th->type_handler_for_implicit_upgrade())
|
||||
{
|
||||
/*
|
||||
The field data type says it wants upgrade.
|
||||
This should not be possible:
|
||||
- if this is a new column definition, e.g. from statements like:
|
||||
ALTER TABLE t1 ADD a INT;
|
||||
ALTER TABLE t1 MODIFY a INT;
|
||||
then it's coming from the parser, which returns
|
||||
only up-to-date data types.
|
||||
- if this is an old column definition, e.g. from:
|
||||
ALTER TABLE t1 COMMENT 'new comment';
|
||||
it should have ealier called Column_definition_implicit_upgrade(),
|
||||
which replaces old data types to up-to-date data types.
|
||||
*/
|
||||
DBUG_ASSERT(0);
|
||||
is_equal= false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_equal)
|
||||
{
|
||||
if (field->table->file->can_convert_nocopy(*field, *new_field))
|
||||
@@ -9139,7 +9154,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
case Alter_drop::CHECK_CONSTRAINT:
|
||||
case Alter_drop::PERIOD:
|
||||
my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0), drop->type_name(),
|
||||
alter_info->drop_list.head()->name);
|
||||
drop->name);
|
||||
goto err;
|
||||
case Alter_drop::FOREIGN_KEY:
|
||||
// Leave the DROP FOREIGN KEY names in the alter_info->drop_list.
|
||||
@@ -10106,12 +10121,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
|
||||
*/
|
||||
KEY *key_info;
|
||||
uint key_count;
|
||||
/*
|
||||
Remember if the new definition has new VARCHAR column;
|
||||
create_info->varchar will be reset in create_table_impl()/
|
||||
mysql_prepare_create_table().
|
||||
*/
|
||||
bool varchar= create_info->varchar, table_creation_was_logged= 0;
|
||||
bool table_creation_was_logged= 0;
|
||||
bool binlog_as_create_select= 0, log_if_exists= 0;
|
||||
uint tables_opened;
|
||||
handlerton *new_db_type= create_info->db_type, *old_db_type;
|
||||
@@ -10929,7 +10939,7 @@ do_continue:;
|
||||
bool use_inplace= true;
|
||||
|
||||
/* Fill the Alter_inplace_info structure. */
|
||||
if (fill_alter_inplace_info(thd, table, varchar, &ha_alter_info))
|
||||
if (fill_alter_inplace_info(thd, table, &ha_alter_info))
|
||||
goto err_new_table_cleanup;
|
||||
|
||||
alter_ctx.tmp_storage_engine_name_partitioned=
|
||||
|
Reference in New Issue
Block a user