I have a MySQL database with some foreign key contstraints.

All tables are InnoDB type. The main table is Restaurant. It references the Type Of Restaurant table and the Price Range table with a foreign key constraints as follows:

alter table Restaurant
add (
constraint RESTAURANT_F2 FOREIGN KEY (PriceName) references PriceRange(Name) ON DELETE CASCADE ON UPDATE CASCADE,
constraint RESTAURANT_F1 FOREIGN KEY (TypeName) references TypeOfRestaurant(Name) ON DELETE CASCADE ON UPDATE CASCADE

When I try and update the TypeName of a TypeOfRestaurant or the Name of a Price Range, I get the following error:

"MySQL Error: Cannot delete a parent row: a foreign key constraint fails in Query"

The code I am using for the update is:

"UPDATE TypeOfRestaurant SET Name=\"$_POST[Name]\" WHERE Name=\"$_POST[OldName]\"

I thought the ON DELETE CASCASE ON UPDATE CASCADE should stop this happening (when a Name is changed, the effect should cascade) ? How can I get round this problem ?