Skip to content

Commit d2fdba9

Browse files
committed
Merge branch '10.9' into 10.10
2 parents 4d6eaf5 + 27dc4cd commit d2fdba9

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

mysql-test/suite/innodb/r/fk_col_alter.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,10 @@ ALTER TABLE t1 MODIFY msg VARCHAR(200) CHARSET utf8mb4, ALGORITHM=COPY;
7575
ALTER TABLE t2 ADD CONSTRAINT FOREIGN KEY (msg) REFERENCES t1(msg), aLGORITHM=INPLACE;
7676
SET FOREIGN_KEY_CHECKS=1;
7777
DROP TABLE t2, t1;
78+
#
79+
# MDEV-31869 Server aborts when table does drop column
80+
#
81+
CREATE TABLE t (a VARCHAR(40), b INT, C INT) ENGINE=InnoDB;
82+
ALTER TABLE t MODIFY a VARCHAR(50), DROP b;
83+
DROP TABLE t;
84+
# End of 10.4 tests

mysql-test/suite/innodb/t/fk_col_alter.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,11 @@ ALTER TABLE t2 ADD CONSTRAINT FOREIGN KEY (msg) REFERENCES t1(msg), aLGORITHM=IN
104104
SET FOREIGN_KEY_CHECKS=1;
105105

106106
DROP TABLE t2, t1;
107+
108+
--echo #
109+
--echo # MDEV-31869 Server aborts when table does drop column
110+
--echo #
111+
CREATE TABLE t (a VARCHAR(40), b INT, C INT) ENGINE=InnoDB;
112+
ALTER TABLE t MODIFY a VARCHAR(50), DROP b;
113+
DROP TABLE t;
114+
--echo # End of 10.4 tests

storage/innobase/handler/handler0alter.cc

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8411,14 +8411,21 @@ ha_innobase::prepare_inplace_alter_table(
84118411
index columns are modified */
84128412
if (ha_alter_info->handler_flags
84138413
& ALTER_COLUMN_TYPE_CHANGE_BY_ENGINE) {
8414-
List_iterator<Create_field> it(
8415-
ha_alter_info->alter_info->create_list);
8416-
for (uint i = 0; i < table->s->fields; i++) {
8414+
8415+
for (uint i= 0; i < table->s->fields; i++) {
84178416
Field* field = table->field[i];
8418-
Create_field *f= it++;
8419-
if (!f->field || field->is_equal(*f))
8420-
continue;
8417+
for (const Create_field& new_field :
8418+
ha_alter_info->alter_info->create_list) {
8419+
if (new_field.field == field) {
8420+
if (!field->is_equal(new_field)) {
8421+
goto field_changed;
8422+
}
8423+
break;
8424+
}
8425+
}
84218426

8427+
continue;
8428+
field_changed:
84228429
const char* col_name= field->field_name.str;
84238430
dict_col_t *col= dict_table_get_nth_col(
84248431
m_prebuilt->table, i);

0 commit comments

Comments
 (0)