Post fix for MDEV-32449

This commit is contained in:
Monty 2023-10-16 12:55:17 +03:00
parent 1c554459b3
commit cca9547892
3 changed files with 17 additions and 2 deletions

View File

@ -3118,6 +3118,12 @@ t2 CREATE TABLE `t2` (
KEY `altcol1` (`altcol1`(2300))
) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 ROW_FORMAT=PAGE
drop table t1,t2;
# Another test for MDEV-32449
CREATE TABLE t1 (a POINT, b POINT, KEY(a)) ENGINE=Aria;
ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t (b);
CREATE TEMPORARY TABLE t2 LIKE t1;
DROP TEMPORARY TABLE t2;
DROP TABLE t1;
#
# End of 10.6 tests
#

View File

@ -2397,6 +2397,14 @@ show create table t1;
show create table t2;
drop table t1,t2;
--echo # Another test for MDEV-32449
CREATE TABLE t1 (a POINT, b POINT, KEY(a)) ENGINE=Aria;
ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t (b);
CREATE TEMPORARY TABLE t2 LIKE t1;
DROP TEMPORARY TABLE t2;
DROP TABLE t1;
--echo #
--echo # End of 10.6 tests
--echo #

View File

@ -2898,10 +2898,11 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
key_iterator.rewind();
while ((key=key_iterator++))
{
if (key->type == Key::IGNORE_KEY && !create_info->tmp_table())
if (key->type == Key::IGNORE_KEY)
{
/* The key was replaced by another key */
if (alter_info->add_stat_drop_index(thd, &key->name))
if (!create_info->tmp_table() &&
alter_info->add_stat_drop_index(thd, &key->name))
DBUG_RETURN(true);
continue;
}