开发者

MySQL & FK constraints

开发者 https://www.devze.com 2023-04-08 10:41 出处:网络
Is there any point in defining FK constraints in MyISAM? MyISAM doesn\'t enforce referential inte开发者_如何转开发grity, right? So maybe there is no point to FK constraints. Although MySQL parses and

Is there any point in defining FK constraints in MyISAM? MyISAM doesn't enforce referential inte开发者_如何转开发grity, right? So maybe there is no point to FK constraints.


Although MySQL parses and ignores them on MyISAM tables, I think you should write them for three reasons.

  • Preparation: Your code will be ready when MyISAM gets there.
  • Documentation: Everybody will know what you intended. Much better than trying to figure out where foreign keys are supposed to go a year from now.
  • Insurance: If MyISAM fails you, you can move directly to InnoDB tables.


http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-foreign-keys.html

At the end of second column:

At a later stage, foreign key constraints will be implemented for MyISAM tables as well.

apparently in mysql 5.0 'latter stage' has not come yet
constraints are needed as an additional validation

0

精彩评论

暂无评论...
验证码 换一张
取 消