Skip to content

Commit

Permalink
Merge mariadb-10.4.31 into 10.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Aug 15, 2023
2 parents 9c8ae6d + 2aea938 commit 6fdc684
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
7 changes: 7 additions & 0 deletions mysql-test/suite/innodb/r/fk_col_alter.result
Expand Up @@ -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
8 changes: 8 additions & 0 deletions mysql-test/suite/innodb/t/fk_col_alter.test
Expand Up @@ -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
19 changes: 13 additions & 6 deletions storage/innobase/handler/handler0alter.cc
Expand Up @@ -8330,14 +8330,21 @@ ha_innobase::prepare_inplace_alter_table(
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++) {

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 (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);
Expand Down

0 comments on commit 6fdc684

Please sign in to comment.