Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
N/A
-
ubuntu 16.04 server
Description
Simple Example:
create table t1(f1 int ,primary key(f1))engine=innodb; |
create table t2(f2 int,f3 int, key t(f2),key t1(f2,f3),foreign key(f2) references t1(f1))engine=innodb; |
create table t3 LIKE t2; |
SHOW CREATE TABLE t2; |
SHOW CREATE TABLE t3; |
`SHOW CREATE TABLE t2;` is correct:
CREATE TABLE `t2` ( |
`f2` int(11) DEFAULT NULL, |
`f3` int(11) DEFAULT NULL, |
KEY `t` (`f2`), |
KEY `t1` (`f2`,`f3`), |
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci |
'SHOW CREATE TABLE t3;' shows that t3 is missing the foreign key constraint:
CREATE TABLE `t3` ( |
`f2` int(11) DEFAULT NULL, |
`f3` int(11) DEFAULT NULL, |
KEY `t` (`f2`), |
KEY `t1` (`f2`,`f3`) |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci |