MySQL 5.1 Is not enforcing FK constraint, when i delete a row from the parent, -


mysql 5.1 : 2 tables (parent , child); fk in child links primary of parent.

when go mysql command line , delete on parent. allowing me delete.

when same test on on mysql 5.6. error "cannot delete or update parent row: foreign key constraint fails" expect.

how possible ? how come mysql not enforcing foreign key constraint ?

one other point both these tables part of replication setup. both these tables replicated similar space on db server on different box..

you have set foreign key on delete cascade. means deleting parent forces child delete itself. error getting because foreign key stops parent deleting because child cannot delete itself.

constraint `child_table`      foreign key (`parent_id`)      references `parent_table` (`id`)      on delete cascade on update cascade 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

qt - How to embed QML toolbar and menubar into QMainWindow -