mysql - Bogus foreign key constraint fail -
i error message:
error 1217 (23000) @ line 40: cannot delete or update parent row: foreign key constraint fails
... when try drop table:
drop table if exists `area`;
... defined this:
create table `area` ( `area_id` char(3) collate utf8_spanish_ci not null, `nombre_area` varchar(30) collate utf8_spanish_ci not null, `descripcion_area` varchar(100) collate utf8_spanish_ci not null, primary key (`area_id`), unique key `nombre_area_unique` (`nombre_area`) ) engine=innodb default charset=utf8 collate=utf8_spanish_ci;
the funny thing i dropped other tables in schema have foreign keys against area
. actually, database empty except area
table.
how can possibly have child rows if there isn't other object in database? far know, innodb doesn't allow foreign keys on other schemas, it?
(i can run rename table area something_else
command :-?)
two possibilities:
- there table within schema ("database" in mysql terminology) has fk reference
- the innodb internal data dictionary out of sync mysql one.
you can see table (one of them, anyway) doing "show engine innodb status" after drop fails.
if turns out latter case, i'd dump , restore whole server if can.
mysql 5.1 , above give name of table fk in error message.
Comments
Post a Comment