DELETE CASCADE
am 05.04.2010 11:18:20 von Aveek MisraI have the following two tables
CREATE TABLE `cfg_tags` (
`cluster` varbinary(128) NOT NULL,
`tag` varbinary(128) NOT NULL,
`user` varchar(40) NOT NULL,
PRIMARY KEY (`cluster`,`tag`)
) ENGINE=3DInnoDB DEFAULT CHARSET=3Dlatin1=20
CREATE TABLE `cfg_cluster_info` (
`cluster` varbinary(128) NOT NULL,
`admin` varbinary(128) NOT NULL,
PRIMARY KEY (`cluster`),
CONSTRAINT `cfg_cluster_info_ibfk_1` FOREIGN KEY (`cluster`) REFERENCES `=
cfg_tags` (`cluster`) ON DELETE CASCADE
) ENGINE=3DInnoDB DEFAULT CHARSET=3Dlatin1
mysql> select * from cfg_tags;
+-----------+------+--------+
| cluster | tag | user |
+-----------+------+--------+
| mycluster | tag1 | aveekm |
| mycluster | tag2 | aveekm |
+-----------+------+--------+
Now when I delete one row from this table for the cluster 'mycluster', all =
the matching rows in the table cfg_cluster_info are deleted. However this i=
s not what I intended. I want that the delete cascade should take effect wh=
en "all" the rows in cfg_tags with 'mycluster' are deleted. Should I then r=
emove the "delete cascade" condition and take care of this myself?
Thanks
Aveek
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg