mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
e32305e505
Thanks to commit 2614a0ab0f
before MDEV-5800, no version of MariaDB is affected by this bug
that was fixed in MySQL 5.7.25.
51 lines
1.7 KiB
Text
51 lines
1.7 KiB
Text
-- source include/have_innodb.inc
|
|
-- source include/not_embedded.inc
|
|
|
|
--echo #
|
|
--echo # Bug#22469130: FOREIGN KEY ON DELETE CASCADE NOT ALLOWED
|
|
--echo # WHEN A VIRTUAL INDEX EXISTS.
|
|
|
|
--echo # Add the VIRTUAL INDEX contains fk constraINT column
|
|
--echo # using INPLACE alter operatiON
|
|
CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY) engine=innodb;
|
|
CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL,
|
|
fld3 INT AS (fld2) VIRTUAL, KEY(fld1),
|
|
FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE) engine=innodb;
|
|
CREATE TABLE u1(a INT, KEY(a)) ENGINE=InnoDB;
|
|
CREATE TABLE u2(b INT, vb INT GENERATED ALWAYS AS(b) VIRTUAL, KEY(vb),
|
|
FOREIGN KEY(b) REFERENCES u1(a)ON DELETE CASCADE)ENGINE=InnoDB;
|
|
|
|
INSERT INTO u1 SET a=1;
|
|
INSERT INTO u2 SET b=1;
|
|
INSERT INTO t1(fld1) VALUES(1);
|
|
INSERT INTO t2(fld1, fld2) VALUES(1, 2);
|
|
--source include/restart_mysqld.inc
|
|
UPDATE t1 SET fld1= 2;
|
|
DELETE FROM u1;
|
|
SELECT * FROM u2;
|
|
DROP TABLE u2,u1;
|
|
SELECT fld3, fld1 FROM t2;
|
|
alter TABLE t2 ADD INDEX vk(fld3, fld1), ALGORITHM=INPLACE;
|
|
UPDATE t1 SET fld1=3;
|
|
SELECT fld3, fld1 FROM t2;
|
|
DROP TABLE t2, t1;
|
|
|
|
--echo # TEMPORARY TABLE NAME and CHILD TABLE NAME are same
|
|
CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY) engine=innodb;
|
|
CREATE TABLE t2(fld1 INT NOT NULL,
|
|
fld2 INT AS (fld1) VIRTUAL,
|
|
KEY(fld2),
|
|
FOREIGN KEY(fld1) REFERENCES t1(fld1)
|
|
ON UPDATE CASCADE) engine=innodb;
|
|
INSERT INTO t1 VALUES(1), (2);
|
|
INSERT INTO t2 VALUES(1, DEFAULT), (2, default);
|
|
--source include/restart_mysqld.inc
|
|
CREATE TEMPORARY TABLE t2 (fld1 INT NOT NULL)ENGINE=INNODB;
|
|
UPDATE t1 SET fld1= 3 WHERE fld1= 2;
|
|
--connect(con1,localhost,root,,test)
|
|
SELECT fld2 FROM t2;
|
|
CHECK TABLE t2;
|
|
connection default;
|
|
disconnect con1;
|
|
DROP TABLE t2;
|
|
DROP TABLE t2, t1;
|