таблицы в одной базе, обе на InnoDB, типы полей одинаковы: VARCHAR(2)
Результат SHOW ENGINE INNODB STATUS:
------------------------
LATEST FOREIGN KEY ERROR
------------------------
2022-02-24 11:35:24 0x3c9c Error in foreign key constraint of table БД/таблица:
FOREIGN KEY (`code`) REFERENCES `БД`.`countries` (`code`)
)
COMMENT='Коммент'
COLLATE='utf8_general_ci'
ENGINE=InnoDB:
Cannot find an index in the referenced table where the
referenced columns appear as the first columns, or column types
in the table and the referenced table do not match for constraint.
Note that the internal storage type of ENUM and SET changed in
tables created with >= InnoDB-4.1.12, and such columns in old tables
cannot be referenced by such columns in new tables.
Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-foreign-key-constraints.html for correct foreign key definition.
DDL таблиц и Ошибки пришли - посмотрим
Обсуждают сегодня