summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t/foreign_key.test
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-08-20 12:52:44 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-08-20 12:52:44 +0300
commitd5d8756de3fa640b69793068937c0293587b16ee (patch)
tree6fa32a78ae8bed380cee057f1f098633fde47df5 /mysql-test/suite/innodb/t/foreign_key.test
parentb205e478a3ba7dfce69bba9e6187d412823b4949 (diff)
parent2fa9f8c53a80e8b52c14d8c3260b18e7e77cc154 (diff)
downloadmariadb-git-d5d8756de3fa640b69793068937c0293587b16ee.tar.gz
Merge 10.4 into 10.5
Diffstat (limited to 'mysql-test/suite/innodb/t/foreign_key.test')
-rw-r--r--mysql-test/suite/innodb/t/foreign_key.test29
1 files changed, 27 insertions, 2 deletions
diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test
index 4719384cd65..c595cf92690 100644
--- a/mysql-test/suite/innodb/t/foreign_key.test
+++ b/mysql-test/suite/innodb/t/foreign_key.test
@@ -657,6 +657,8 @@ SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
--echo # with CONSTRAINTs
--echo #
+call mtr.add_suppression("\\[Warning\\] InnoDB: In ALTER TABLE `test`\\.`t2` has or is referenced in foreign key constraints which are not compatible with the new table definition.");
+
set foreign_key_checks=on;
create table t1 (id int not null primary key) engine=innodb;
create table t2 (id int not null primary key, fid int not null,
@@ -698,6 +700,27 @@ drop table t1,t2;
--error ER_BAD_TABLE_ERROR
drop table t1,t2;
+--echo #
+--echo # MDEV-22934 Table disappear after two alter table command
+--echo #
+CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT,
+ f2 INT NOT NULL,
+ PRIMARY KEY (f1), INDEX (f2))ENGINE=InnoDB;
+CREATE TABLE t2(f1 INT NOT NULL,
+ f2 INT NOT NULL, f3 INT NOT NULL,
+ PRIMARY KEY(f1, f2), UNIQUE KEY(f2),
+CONSTRAINT `t2_ibfk_1` FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE CASCADE,
+CONSTRAINT `t2_ibfk_2` FOREIGN KEY (f1) REFERENCES t1(f1) ON DELETE CASCADE
+) ENGINE=InnoDB;
+
+SET FOREIGN_KEY_CHECKS=0;
+ALTER TABLE t2 DROP PRIMARY KEY, ADD PRIMARY KEY(f3), ALGORITHM=INPLACE;
+ALTER TABLE t2 DROP INDEX `f2`, ALGORITHM=COPY;
+SHOW CREATE TABLE t2;
+--error ER_TABLE_EXISTS_ERROR
+CREATE TABLE t2 (f1 INT NOT NULL)ENGINE=InnoDB;
+DROP TABLE t2, t1;
+
--echo # End of 10.2 tests
# MDEV-21792 Server aborts upon attempt to create foreign key on spatial field
@@ -732,15 +755,15 @@ set default_storage_engine= default;
--echo #
--echo # MDEV-21690 LeakSanitizer: detected memory leaks in mem_heap_create_block_func
--echo #
+SET FOREIGN_KEY_CHECKS=1;
CREATE TABLE t1 (a TEXT, b TEXT) ENGINE=InnoDB;
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (b);
+SET FOREIGN_KEY_CHECKS=DEFAULT;
# Cleanup
DROP TABLE t1;
---echo # End of 10.5 tests
-
--echo #
--echo # MDEV-22602 Disable UPDATE CASCADE for SQL constraints
--echo #
@@ -764,4 +787,6 @@ create or replace table t2 (pk int primary key, a varchar(4096) unique, foreign
drop table t1;
+--echo # End of 10.5 tests
+
--source include/wait_until_count_sessions.inc