Skip to content

Commit cca9547

Browse files
committed
Post fix for MDEV-32449
1 parent 1c55445 commit cca9547

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

mysql-test/main/alter_table.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3118,6 +3118,12 @@ t2 CREATE TABLE `t2` (
31183118
KEY `altcol1` (`altcol1`(2300))
31193119
) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 ROW_FORMAT=PAGE
31203120
drop table t1,t2;
3121+
# Another test for MDEV-32449
3122+
CREATE TABLE t1 (a POINT, b POINT, KEY(a)) ENGINE=Aria;
3123+
ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t (b);
3124+
CREATE TEMPORARY TABLE t2 LIKE t1;
3125+
DROP TEMPORARY TABLE t2;
3126+
DROP TABLE t1;
31213127
#
31223128
# End of 10.6 tests
31233129
#

mysql-test/main/alter_table.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2397,6 +2397,14 @@ show create table t1;
23972397
show create table t2;
23982398
drop table t1,t2;
23992399

2400+
--echo # Another test for MDEV-32449
2401+
2402+
CREATE TABLE t1 (a POINT, b POINT, KEY(a)) ENGINE=Aria;
2403+
ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t (b);
2404+
CREATE TEMPORARY TABLE t2 LIKE t1;
2405+
DROP TEMPORARY TABLE t2;
2406+
DROP TABLE t1;
2407+
24002408
--echo #
24012409
--echo # End of 10.6 tests
24022410
--echo #

sql/sql_table.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2898,10 +2898,11 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
28982898
key_iterator.rewind();
28992899
while ((key=key_iterator++))
29002900
{
2901-
if (key->type == Key::IGNORE_KEY && !create_info->tmp_table())
2901+
if (key->type == Key::IGNORE_KEY)
29022902
{
29032903
/* The key was replaced by another key */
2904-
if (alter_info->add_stat_drop_index(thd, &key->name))
2904+
if (!create_info->tmp_table() &&
2905+
alter_info->add_stat_drop_index(thd, &key->name))
29052906
DBUG_RETURN(true);
29062907
continue;
29072908
}

0 commit comments

Comments
 (0)