Debian Codegraph @

mysql-test/suite/innodb/r/fk_drop_alter.result

raw
1 #
2 # MDEV-22230 : Unexpected ER_ERROR_ON_RENAME upon DROP
3 # non-existing FOREIGN KEY
4 #
5 CREATE TABLE t1 (a INT) ENGINE=InnoDB;
6 ALTER TABLE t1 DROP FOREIGN KEY x, ALGORITHM=COPY;
7 ERROR 42000: Can't DROP FOREIGN KEY `x`; check that it exists
8 ALTER TABLE t1 DROP FOREIGN KEY x, ALGORITHM=INPLACE;
9 ERROR 42000: Can't DROP FOREIGN KEY `x`; check that it exists
10 DROP TABLE t1;
11 CREATE TABLE t1 (a INT, KEY(a)) ENGINE=InnoDB;
12 CREATE TABLE t2 (a INT, FOREIGN KEY fk_id (a) REFERENCES t1(a))ENGINE=InnoDB;
13 CREATE TABLE t3 (a INT, FOREIGN KEY fk_1 (a) REFERENCES t1(a))ENGINE=InnoDB;
14 ALTER TABLE t3 DROP FOREIGN KEY IF EXISTS fk_id;
15 Warnings:
16 Note 1091 Can't DROP FOREIGN KEY `fk_id`; check that it exists
17 DROP TABLE t3, t2;
18 ALTER TABLE t1 MODIFY COLUMN a VARCHAR(2), DROP FOREIGN KEY IF EXISTS x;
19 Warnings:
20 Note 1091 Can't DROP FOREIGN KEY `x`; check that it exists
21 DROP TABLE t1;
22 CREATE DATABASE best;
23 CREATE TABLE best.t1(f1 INT, KEY(f1))ENGINE=InnoDB;
24 CREATE TABLE best.t2(f1 INT, FOREIGN KEY foo(f1) REFERENCES t1(f1))ENGINE=InnoDB;
25 CREATE TABLE t1(f1 INT, KEY(f1))ENGINE=InnoDB;
26 CREATE TABLE t2(f1 INT, FOREIGN KEY foo(f1) REFERENCES t1(f1))ENGINE=InnoDB;
27 ALTER TABLE t2 DROP FOREIGN KEY foo;
28 ALTER TABLE t2 DROP FOREIGN KEY foo;
29 ERROR 42000: Can't DROP FOREIGN KEY `foo`; check that it exists
30 ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS foo;
31 Warnings:
32 Note 1091 Can't DROP FOREIGN KEY `foo`; check that it exists
33 SHOW CREATE TABLE best.t2;
34 Table Create Table
35 t2 CREATE TABLE `t2` (
36 `f1` int(11) DEFAULT NULL,
37 KEY `foo` (`f1`),
38 CONSTRAINT `foo` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`)
39 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
40 SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
41 ID FOR_NAME REF_NAME N_COLS TYPE
42 best/foo best/t2 best/t1 1 0
43 DROP TABLE best.t2, best.t1, t2, t1;
44 DROP DATABASE best;