OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: How to Use Cascade Delete Properly

From: Lola J. Lee Beno (lolahis.com)
Date: Fri Jan 02 2009 - 05:03:59 CST


Ian Simpson wrote:
> If you want deletes to be blocked, then you shouldn't be using ON DELETE
> CASCADE; the default behaviour is ON DELETE CONSTRAIN, which seems to be
> what you want; it will refuse to delete any rows that are depended on by
> rows in other tables.
>

Wouldn't that be:

ALTER TABLE `jobsearchtwodb`.`jobposts` ADD CONSTRAINT `adsourcefk`
FOREIGN KEY `adsourcefk` (`adsource_id`)
    REFERENCES `adsource` (`adsource_id`)
    ON DELETE RESTRICT
    ON UPDATE NO ACTION;

ON DELETE RESTRICT having the behavior like ON DELETE CONSTRAIN?

--
Lola J. Lee Beno - ColdFusion Programmer/Web Designer for Hire
http://www.lolajl.net/resume | Blog at http://www.lolajl.net/blog/
"No greater injury can be done to any youth than to let him feel that
because he belongs to this or that race he will be advanced in life
regardless of his own merits or efforts." - Booker T. Washington

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql