summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 9a0fba6e9d7..db64c5afbc2 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -6613,6 +6613,12 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
if (def)
{ // Field is changed
def->field=field;
+ /*
+ Add column being updated to the list of new columns.
+ Note that columns with AFTER clauses are added to the end
+ of the list for now. Their positions will be corrected later.
+ */
+ new_create_list.push_back(def);
if (field->stored_in_db != def->stored_in_db)
{
my_error(ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN, MYF(0));
@@ -6620,7 +6626,13 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
}
if (!def->after)
{
- new_create_list.push_back(def);
+ /*
+ If this ALTER TABLE doesn't have an AFTER clause for the modified
+ column then remove this column from the list of columns to be
+ processed. So later we can iterate over the columns remaining
+ in this list and process modified columns with AFTER clause or
+ add new columns.
+ */
def_it.remove();
}
}