我用 MySQL 创建了一个联合表,我发现生成的本地表只包含远程表数据的子集。
这是联邦:
CREATE TABLE `Activities` (
`idActivity` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Periods_idPeriod` int(10) unsigned NOT NULL DEFAULT 1,
`applicationActivityId` varchar(255) DEFAULT NULL,
`previousApplicationActivityId` varchar(255) DEFAULT NULL,
`title` text,
`ActivityTypes_idActivityType` int(10) unsigned DEFAULT 4,
`comment1` text,
`comment2` text,
`comment3` text,
`Areas_idArea` int(10) unsigned DEFAULT NULL,
`sentReports` int(11) DEFAULT '1',
PRIMARY KEY (`idActivity`)
) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://admin:*******@*******:3306/sup_supperdb/Activities';
这是远程(原始)之一:
CREATE TABLE `Activities` (
`idActivity` int(10) unsigned NOT NULL auto_increment,
`Periods_idPeriod` int(10) unsigned NOT NULL default '0',
`applicationActivityId` varchar(255) default NULL,
`previousApplicationActivityId` varchar(255) default NULL,
`title` text,
`ActivityTypes_idActivityType` int(10) unsigned default NULL,
`comment1` text,
`comment2` text,
`comment3` text,
`Areas_idArea` int(10) unsigned default NULL,
`sentReports` int(11) default '1',
PRIMARY KEY (`idActivity`),
KEY `Activities_FKIndex1` (`Periods_idPeriod`),
KEY `Areas_idArea` (`Areas_idArea`),
KEY `ActivityTypes_idActivityType` (`ActivityTypes_idActivityType`),
CONSTRAINT `Activities_ibfk_1` FOREIGN KEY (`Areas_idArea`) REFERENCES `Areas` (`idArea`) ON DELETE SET NULL,
CONSTRAINT `Activities_ibfk_2` FOREIGN KEY (`ActivityTypes_idActivityType`) REFERENCES `ActivityTypes` (`idActivityType`) ON DELETE SET NULL,
CONSTRAINT `Activities_ibfk_3` FOREIGN KEY (`Periods_idPeriod`) REFERENCES `Periods` (`idPeriod`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
在原始行中,我得到 3045 行,但在联邦中只有 2946 行。
如果有人对可能发生的事情有提示,或者是否存在某种联合表限制,他的评论将不胜感激。