[rt-devel] primary keys on table
Olly Stephens
olly at scatcat.demon.co.uk
Fri Oct 18 17:06:17 EDT 2002
At 15:24 18/10/2002 -0400, Jesse Vincent wrote:
>On Fri, Oct 18, 2002 at 03:13:38PM -0400, Vivek Khera wrote:
> > Someone here (or on rt-users) swore up and down that MySQL supports
> > referential integrity via foreign keys now. I have no clue.
>
>It supports defining the relationships, but doesn't actually do anything
>with them.
The manual implies that this now works for InnoDB's:
Source: http://www.mysql.com/doc/en/SEC447.html
Starting from version 3.23.50 you can also associate the ON DELETE CASCADE
or ON DELETE SET NULL clause with the foreign key constraint.
If ON DELETE CASCADE is specified, and a row in the parent table is
deleted, then InnoDB automatically deletes also all those rows in the child
table whose foreign key values are equal to the referenced key value in the
parent row. If ON DELETE SET NULL is specified, the child rows are
automatically updated so that the columns in the foreign key are set to the
SQL NULL value.
Must admit I haven't tried though...
Olly
More information about the Rt-devel
mailing list