File: fk_drop_alter.result

package info (click to toggle)
mariadb 1%3A10.11.11-0%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 597,064 kB
  • sloc: ansic: 2,386,076; cpp: 1,663,071; asm: 378,311; perl: 62,203; pascal: 38,769; sh: 37,071; java: 33,919; sql: 19,830; yacc: 19,727; xml: 10,509; python: 9,522; ruby: 8,544; cs: 5,855; makefile: 5,793; ada: 1,700; lex: 1,207; javascript: 1,039; objc: 80; tcl: 73; awk: 46; php: 22
file content (44 lines) | stat: -rw-r--r-- 1,822 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#
#  MDEV-22230 : Unexpected ER_ERROR_ON_RENAME upon DROP
#	non-existing FOREIGN KEY
#
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
ALTER TABLE t1 DROP FOREIGN KEY x, ALGORITHM=COPY;
ERROR 42000: Can't DROP FOREIGN KEY `x`; check that it exists
ALTER TABLE t1 DROP FOREIGN KEY x, ALGORITHM=INPLACE;
ERROR 42000: Can't DROP FOREIGN KEY `x`; check that it exists
DROP TABLE t1;
CREATE TABLE t1 (a INT, KEY(a)) ENGINE=InnoDB;
CREATE TABLE t2 (a INT, FOREIGN KEY fk_id (a) REFERENCES t1(a))ENGINE=InnoDB;
CREATE TABLE t3 (a INT, FOREIGN KEY fk_1 (a) REFERENCES t1(a))ENGINE=InnoDB;
ALTER TABLE t3 DROP FOREIGN KEY IF EXISTS fk_id;
Warnings:
Note	1091	Can't DROP FOREIGN KEY `fk_id`; check that it exists
DROP TABLE t3, t2;
ALTER TABLE t1 MODIFY COLUMN a VARCHAR(2), DROP FOREIGN KEY IF EXISTS x;
Warnings:
Note	1091	Can't DROP FOREIGN KEY `x`; check that it exists
DROP TABLE t1;
CREATE DATABASE best;
CREATE TABLE best.t1(f1 INT, KEY(f1))ENGINE=InnoDB;
CREATE TABLE best.t2(f1 INT, FOREIGN KEY foo(f1) REFERENCES t1(f1))ENGINE=InnoDB;
CREATE TABLE t1(f1 INT, KEY(f1))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, FOREIGN KEY foo(f1) REFERENCES t1(f1))ENGINE=InnoDB;
ALTER TABLE t2 DROP FOREIGN KEY foo;
ALTER TABLE t2 DROP FOREIGN KEY foo;
ERROR 42000: Can't DROP FOREIGN KEY `foo`; check that it exists
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS foo;
Warnings:
Note	1091	Can't DROP FOREIGN KEY `foo`; check that it exists
SHOW CREATE TABLE best.t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `f1` int(11) DEFAULT NULL,
  KEY `foo` (`f1`),
  CONSTRAINT `foo` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID	FOR_NAME	REF_NAME	N_COLS	TYPE
best/foo	best/t2	best/t1	1	0
DROP TABLE best.t2, best.t1, t2, t1;
DROP DATABASE best;