diff options
author | Monty <monty@mariadb.org> | 2018-05-22 23:05:01 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2018-05-22 23:08:26 +0300 |
commit | 908676dfd9d981fd0f37a7cf9332abac522f1936 (patch) | |
tree | 23e43af8bed99d048e154f7b8fe30b8c47c90442 /sql/sql_table.cc | |
parent | da71c1bad79ee11009b3b28a2a745709e04020cf (diff) | |
download | mariadb-git-908676dfd9d981fd0f37a7cf9332abac522f1936.tar.gz |
MDEV-15308 Assertion `ha_alter_info->alter_info->drop_list.elementsbb-10.0-monty
Problem was that handle_if_exists_options() didn't correct
alter_info->flags when things was removed from the list.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 27d579a6b19..376c1362cc7 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -5808,10 +5808,28 @@ drop_create_field: List_iterator<Alter_drop> drop_it(alter_info->drop_list); Alter_drop *drop; bool remove_drop; + ulonglong left_flags= 0; while ((drop= drop_it++)) { + ulonglong cur_flag= 0; + switch (drop->type) { + case Alter_drop::COLUMN: + cur_flag= Alter_info::ALTER_DROP_COLUMN; + break; + case Alter_drop::FOREIGN_KEY: + cur_flag= Alter_info::DROP_FOREIGN_KEY; + break; + case Alter_drop::KEY: + cur_flag= Alter_info::ALTER_DROP_INDEX; + break; + default: + break; + } if (!drop->drop_if_exists) + { + left_flags|= cur_flag; continue; + } remove_drop= TRUE; if (drop->type == Alter_drop::COLUMN) { @@ -5887,12 +5905,15 @@ drop_create_field: ER_CANT_DROP_FIELD_OR_KEY, ER(ER_CANT_DROP_FIELD_OR_KEY), drop->name); drop_it.remove(); - if (alter_info->drop_list.is_empty()) - alter_info->flags&= ~(Alter_info::ALTER_DROP_COLUMN | - Alter_info::ALTER_DROP_INDEX | - Alter_info::DROP_FOREIGN_KEY); } + else + left_flags|= cur_flag; } + /* Reset state to what's left in drop list */ + alter_info->flags&= ~(Alter_info::ALTER_DROP_COLUMN | + Alter_info::ALTER_DROP_INDEX | + Alter_info::DROP_FOREIGN_KEY); + alter_info->flags|= left_flags; } /* ALTER TABLE ADD KEY IF NOT EXISTS */ |