Debian Codegraph @

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

raw
1 create database bug_fk;
2 use bug_fk;
3 CREATE TABLE b (
4 b int unsigned NOT NULL,
5 d1 datetime NOT NULL,
6 PRIMARY KEY (b,d1)
7 ) ENGINE=InnoDB;
8 CREATE TABLE c (
9 b int unsigned NOT NULL,
10 d1 datetime NOT NULL,
11 d2 datetime NOT NULL,
12 PRIMARY KEY (b,d1),
13 CONSTRAINT b_fk FOREIGN KEY (b) REFERENCES b (b)
14 ) ENGINE=InnoDB;
15 show warnings;
16 Level Code Message
17 set foreign_key_checks = 0;
18 DROP TABLE IF EXISTS b;
19 show create table c;
20 Table Create Table
21 c CREATE TABLE `c` (
22 `b` int(10) unsigned NOT NULL,
23 `d1` datetime NOT NULL,
24 `d2` datetime NOT NULL,
25 PRIMARY KEY (`b`,`d1`),
26 CONSTRAINT `b_fk` FOREIGN KEY (`b`) REFERENCES `b` (`b`)
27 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
28 CREATE TABLE b (
29 b bigint unsigned NOT NULL,
30 d1 date NOT NULL,
31 PRIMARY KEY (b,d1)
32 ) ENGINE=InnoDB;
33 DROP TABLE b;
34 set foreign_key_checks = 1;
35 CREATE TABLE b (
36 b bigint unsigned NOT NULL,
37 d1 date NOT NULL,
38 PRIMARY KEY (b,d1)
39 ) ENGINE=InnoDB;
40 ERROR HY000: Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed")
41 show warnings;
42 Level Code Message
43 Error 1005 Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed")
44 Warning 1215 Cannot add foreign key constraint for `b`
45 set foreign_key_checks = 0;
46 DROP TABLE IF EXISTS d;
47 Warnings:
48 Note 1051 Unknown table 'bug_fk.d'
49 CREATE TABLE d (
50 b bigint unsigned NOT NULL,
51 d1 date NOT NULL,
52 PRIMARY KEY (b,d1),
53 CONSTRAINT bd_fk FOREIGN KEY (b) REFERENCES b (b)
54 ) ENGINE=InnoDB;
55 show warnings;
56 Level Code Message
57 set foreign_key_checks = 1;
58 show create table c;
59 Table Create Table
60 c CREATE TABLE `c` (
61 `b` int(10) unsigned NOT NULL,
62 `d1` datetime NOT NULL,
63 `d2` datetime NOT NULL,
64 PRIMARY KEY (`b`,`d1`),
65 CONSTRAINT `b_fk` FOREIGN KEY (`b`) REFERENCES `b` (`b`)
66 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
67 show create table d;
68 Table Create Table
69 d CREATE TABLE `d` (
70 `b` bigint(20) unsigned NOT NULL,
71 `d1` date NOT NULL,
72 PRIMARY KEY (`b`,`d1`),
73 CONSTRAINT `bd_fk` FOREIGN KEY (`b`) REFERENCES `b` (`b`)
74 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
75 CREATE TABLE b (
76 b bigint unsigned NOT NULL,
77 d1 date NOT NULL,
78 PRIMARY KEY (b,d1)
79 ) ENGINE=InnoDB;
80 ERROR HY000: Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed")
81 show warnings;
82 Level Code Message
83 Error 1005 Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed")
84 Warning 1215 Cannot add foreign key constraint for `b`
85 set foreign_key_checks=0;
86 drop table c;
87 drop table d;
88 create table b(id int) engine=innodb;
89 show warnings;
90 Level Code Message
91 b.frm
92 b.ibd
93 drop table b;
94 drop database bug_fk;