创建下表时出现 errno 150。前两个工作正常,但第三个抛出此错误:
ERROR 1005 (HY000): Can't create table 'test2.exercise_type_exercise_groups' (errno: 150)
有任何想法吗?我检查了所有键列的类型、长度、字符集和排序规则是否相同......还有什么问题?
在此先感谢您的帮助!
CREATE TABLE `exercise_groups` (
`id` VARCHAR(255) NOT NULL,
PRIMARY KEY `pk_exercise_groups` (`id`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
CREATE TABLE `exercise_types` (
`id` VARCHAR(255) NOT NULL,
PRIMARY KEY `pk_exercise_types` (`id`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
CREATE TABLE `exercise_type_exercise_groups` (
`exercise_type` VARCHAR(255) NOT NULL,
`exercise_group` VARCHAR(255) NOT NULL,
`link_type` ENUM('primary', 'ancillary'),
PRIMARY KEY `pk_exercise_type_exercise_groups` (`exercise_type`, `exercise_group`),
CONSTRAINT `fk_exercise_type_exercise_groups_exercise_type`
FOREIGN KEY (`exercise_type`)
REFERENCES `exercise_type` (`id`),
CONSTRAINT `fk_exercise_type_exercise_groups_exercise_group`
FOREIGN KEY (`exercise_group`)
REFERENCES `exercise_group` (`id`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;