mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-31869 Server aborts when table does drop column
- InnoDB aborts when table is dropping the column. This is
caused by 5f09b53bdb
(MDEV-31086).
While iterating the altered table fields, we fail to consider
the dropped columns.
This commit is contained in:
parent
ab10a675ac
commit
0ede90dd31
3 changed files with 29 additions and 7 deletions
|
@ -75,3 +75,10 @@ ALTER TABLE t1 MODIFY msg VARCHAR(200) CHARSET utf8mb4, ALGORITHM=COPY;
|
|||
ALTER TABLE t2 ADD CONSTRAINT FOREIGN KEY (msg) REFERENCES t1(msg), aLGORITHM=INPLACE;
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
DROP TABLE t2, t1;
|
||||
#
|
||||
# MDEV-31869 Server aborts when table does drop column
|
||||
#
|
||||
CREATE TABLE t (a VARCHAR(40), b INT, C INT) ENGINE=InnoDB;
|
||||
ALTER TABLE t MODIFY a VARCHAR(50), DROP b;
|
||||
DROP TABLE t;
|
||||
# End of 10.4 tests
|
||||
|
|
|
@ -104,3 +104,11 @@ ALTER TABLE t2 ADD CONSTRAINT FOREIGN KEY (msg) REFERENCES t1(msg), aLGORITHM=IN
|
|||
SET FOREIGN_KEY_CHECKS=1;
|
||||
|
||||
DROP TABLE t2, t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-31869 Server aborts when table does drop column
|
||||
--echo #
|
||||
CREATE TABLE t (a VARCHAR(40), b INT, C INT) ENGINE=InnoDB;
|
||||
ALTER TABLE t MODIFY a VARCHAR(50), DROP b;
|
||||
DROP TABLE t;
|
||||
--echo # End of 10.4 tests
|
||||
|
|
|
@ -8330,14 +8330,21 @@ err_exit:
|
|||
index columns are modified */
|
||||
if (ha_alter_info->handler_flags
|
||||
& ALTER_COLUMN_TYPE_CHANGE_BY_ENGINE) {
|
||||
List_iterator<Create_field> it(
|
||||
ha_alter_info->alter_info->create_list);
|
||||
for (uint i = 0; i < table->s->fields; i++) {
|
||||
Field* field = table->field[i];
|
||||
Create_field *f= it++;
|
||||
if (!f->field || field->is_equal(*f))
|
||||
continue;
|
||||
|
||||
for (uint i= 0; i < table->s->fields; i++) {
|
||||
Field* field = table->field[i];
|
||||
for (const Create_field& new_field :
|
||||
ha_alter_info->alter_info->create_list) {
|
||||
if (new_field.field == field) {
|
||||
if (!field->is_equal(new_field)) {
|
||||
goto field_changed;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
field_changed:
|
||||
const char* col_name= field->field_name.str;
|
||||
dict_col_t *col= dict_table_get_nth_col(
|
||||
m_prebuilt->table, i);
|
||||
|
|
Loading…
Reference in a new issue