Improved Foreign Key Error Messages in MySQL 5.6

Flite Culture

It took a small more than 10 years, but as of version 5.6 MySQL is finally using error code 1215! Since MySQL first introduced foreign key support more than 10 years ago in version 3.23.44, all the way through version 5.5, the server has always given a generic 1005 error when you try to add an invalid foreign key.

Here’s an example in MySQL 5.5, where the parent key is unsigned and the child key is signed:

Yogurt-Fruit Muffins with Bran Crumb Topping
Bake the muffins until a toothpick inserted in the center comes out with moist crumbs attached, 15 to 18 minutes. For the topping: Combine the bran , walnuts and sugars in a food processor and process until coarsely ground.

mysql> create table parent ( -> id int unsigned primary key -> ) engine = innodb; Query OK, 0 rows affected (0.01 sec) mysql> create table child ( -> id int primary key, -> parent_id int, -> foreign key fk_child_to_parent (parent_id) references parent (id) -> ) engine = innodb; ERROR 1005 (HY000): Can't create table 'test.child' (errno: 150)

Error 1005 doesn’t give me any clue about why the DDL failed. If I run SHOW ENGINE INNODB STATUS and look at the “LATEST FOREIGN KEY ERROR” section I can get more details.

Virginia National Guard Code of laws, results in each Soldier holding membership in both the National Guard of his or her state and in the U.S. It is also the organized militia of 54 separate entities: the 50 states, the territories of Guam and the U.S.
More... Introduction to Flying with Pets A door made of welded or cast metal of sufficient gauge or thickness so as to preclude animal from bending or distorting door. The size crate you choose must be large enough for your pet to turn around in, stand without touching the top, and sit up.
More... Madhat Alsoos You can see the properties of any dll to find its path, my tbb_debug.dll lies on: "E:\Intel\Compiler\11.154\tbb\intel64\vc9\bin". When I run my application it tries to load cv2010d.dll which tries to load all of its dependencies including tbb_debug.dll.
More... How To Write a Split Screen Scene: the Annie Hall Example Last week I read the four times Oscar succeeder Annie Hall* ( 1977 ) , and was pleased to discover two split-screen scenes in it. A lot of us can’t donate, but if you can, and feel this website deserves your help, any amount will make a difference.
More... ALEXANDER THE GREAT ANCIENT GREECE PowerPoint PPT Presentation ALEXANDER THE GREAT ANCIENT GREECE Alexander changed the world, but not through his accomplishments on the battlefield. Long after Alexander’s empire fell apart, Hellenism produced great advances in science, philosophy, and drama.
More...

More news