2003年 7月 7日 月曜日 17:43、Rafal Kedziorski さんは書きました: > hi, > > I'm porting an PostgreSQL script to MySQL. I get an error: > > Can't create table '.\mmcms\mandant.frm' (errno: 150) > > for this tables: > > CREATE TABLE `firm` ( > `firm_id` SMALLINT NOT NULL AUTO_INCREMENT, > `name` VARCHAR (40) NOT NULL, > # > PRIMARY KEY (`firm_id`) > ) TYPE=InnoDB; > > > CREATE TABLE `mandant` ( > `mandant_id` SMALLINT NOT NULL AUTO_INCREMENT, > `firm_id` SMALLINT NOT NULL, > `parent_id` SMALLINT, > `name` VARCHAR (20) NOT NULL, > `creation_date` TIMESTAMP NOT NULL, > # > PRIMARY KEY (`mandant_id`), > FOREIGN KEY (`firm_id`) > REFERENCES `firm` (`firm_id`), > FOREIGN KEY (`parent_id`) > REFERENCES `mandant` (`mandant_id`) > ) TYPE=InnoDB;
The foreign key points to the table mandant. But the column mandant_id is not indexed. (f.e no Primary key)
dasn't PRIMARY KEY create an INDEX?
Rafal
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]