1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Merged fix for bug #12652385 - "61493: REORDERING COLUMNS

TO POSITION FIRST CAN CAUSE DATA TO BE CORRUPTED" into
mysql-5.5 tree.
This commit is contained in:
Dmitry Lenev
2011-06-17 02:50:07 +04:00
3 changed files with 73 additions and 0 deletions

View File

@@ -5326,6 +5326,12 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
if (drop)
{
drop_it.remove();
/*
ALTER TABLE DROP COLUMN always changes table data even in cases
when new version of the table has the same structure as the old
one.
*/
alter_info->change_level= ALTER_TABLE_DATA_CHANGED;
continue;
}
/* Check if field is changed */
@@ -5403,7 +5409,14 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
if (!def->after)
new_create_list.push_back(def);
else if (def->after == first_keyword)
{
new_create_list.push_front(def);
/*
Re-ordering columns in table can't be done using in-place algorithm
as it always changes table data.
*/
alter_info->change_level= ALTER_TABLE_DATA_CHANGED;
}
else
{
Create_field *find;
@@ -5419,6 +5432,10 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
goto err;
}
find_it.after(def); // Put element after this
/*
Re-ordering columns in table can't be done using in-place algorithm
as it always changes table data.
*/
alter_info->change_level= ALTER_TABLE_DATA_CHANGED;
}
}