diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2022-12-01 16:34:17 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2022-12-01 16:34:17 +0300 |
commit | cc86360f4afb5b7b9fe64bbffef18538b2e3589b (patch) | |
tree | 05a19e719105ab3f633e135239e97e0aab64ce24 | |
parent | b527bfe82310dba39894feff61a1cd7d76a8cc4c (diff) | |
download | mariadb-git-cc86360f4afb5b7b9fe64bbffef18538b2e3589b.tar.gz |
MDEV-30112 ASAN errors in Item_ident::print / generate_partition_syntaxbb-10.3-midenok
Like in MDEV-16110 we must release items allocated on thd->mem_root by
reopening the table.
MDEV-16290 relocated MDEV-16110 fix in 10.5 so it works for MDEV-28576
as well. 10.3 without MDEV-16290 now duplicates this fix.
-rw-r--r-- | mysql-test/main/partition_alter.result | 13 | ||||
-rw-r--r-- | mysql-test/main/partition_alter.test | 10 | ||||
-rw-r--r-- | sql/sql_table.cc | 2 |
3 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/main/partition_alter.result b/mysql-test/main/partition_alter.result index 2b0a09d2653..09a6cec2ed8 100644 --- a/mysql-test/main/partition_alter.result +++ b/mysql-test/main/partition_alter.result @@ -211,4 +211,17 @@ Table Op Msg_type Msg_text test.t check status OK delete from t order by b limit 1; drop table t; +# +# MDEV-30112 ASAN errors in Item_ident::print / generate_partition_syntax +# +create table t (a int) partition by hash(a); +alter table t change a b int, drop a; +ERROR 42S22: Unknown column 'a' in 't' +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY HASH (`a`) +drop table t; # End of 10.3 tests diff --git a/mysql-test/main/partition_alter.test b/mysql-test/main/partition_alter.test index 7a80779e386..1228ccf7ac9 100644 --- a/mysql-test/main/partition_alter.test +++ b/mysql-test/main/partition_alter.test @@ -196,4 +196,14 @@ delete from t order by b limit 1; # cleanup drop table t; +--echo # +--echo # MDEV-30112 ASAN errors in Item_ident::print / generate_partition_syntax +--echo # +create table t (a int) partition by hash(a); +--error ER_BAD_FIELD_ERROR +alter table t change a b int, drop a; +show create table t; +# Cleanup +drop table t; + --echo # End of 10.3 tests diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 413d78ae814..042ed9e1d6f 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -8328,6 +8328,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, } /* if (def->change.str) */ } /* while (def) */ } /* if (part_field_list || subpart_field_list) */ + // Force reopen because new column name is on thd->mem_root + table->mark_table_for_reopen(); } /* if (part_info) */ } #endif |