← Back to team overview

maria-discuss team mailing list archive

Problems with Foreign Key

 

Hi all,

	Any idea why I am getting this error:


A) ERROR

ALTER TABLE login -> ADD CONSTRAINT fk_db_perfil FOREIGN KEY (id_perfil) -> REFERENCES db_perfil (id_perfil) -> ON DELETE NO ACTION -> ON UPDATE NO ACTION;ERROR 1005 (HY000): Can't create table 'dbhomo_aa.#sql-c1f_281' (errno: 150)dbhomo_aa-> dbhomo_aa->


B) HERE IT WORKS

dbhomo_aa-> ALTER TABLE login ADD CONSTRAINT fk_db_perfil FOREIGN KEY (id_perfil) REFERENCES dbhomo.db_perfil (id_perfil) ON DELETE NO ACTION ON UPDATE NO ACTION;
Query OK, 35199 rows affected (3,27 sec)
Records: 35199  Duplicates: 0  Warnings: 0



Note that when I change the database to the original database the command works as expected. Both tables are innodb, the permissions are fine.

Thanks,

Alex



Follow ups