From: Date: March 17 2003 4:47am Subject: Re: Foreign Key and default action/RESTRICT behaviour? List-Archive: http://lists.mysql.com/mysql/134863 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" ; format="flowed" At 4:13 +0100 3/17/03, Andreas wrote: >>>RESTRICT is, of course, the default 'action'. ON DELETE and ON UPDATE are >>>later additions. >> >Paul DuBois wrote: >>I see in the change notes that ON UPDATE was implemented in 4.0.8. >> >>But how can ON DELETE be a later addition than RESTRICT? I was under the >>impression that RESTRICT wasn't even implemented. >> >>Also, the manual lists SET DEFAULT as a reference option for the general >>CREATE TABLE syntax. Does that come into play for InnoDB at all? > >As I get it, RESTRICT is no real "action" at all, since all it does >is watching the foreign key restriction to be followed. That's an action in the sense that it prevents a parent table record from being deleted. > >ON DELETE was implemented because it makes sense and is actually >useful to safe some work. What I meant is that because RESTRICT is one of the options for the ON DELETE clause, you cannot implement RESTRICT *before* ON DELETE. You cannot implement an option before the clause that it is an option *of*. It makes sense to say that ON UPDATE was updated after ON DELETE, because it was. >ON UPDATE seams to me to be more exotic since most foreign keys have >a primary key on one side, so the update target is a primary key, >which is not really elegant in my view. > >Both actions DELETE and UPDATE have drawbacks if you have some >relations not covered by an explicit foreign-key-rule or if some >tables are still myisam. > >Anyway RESTRICT is the core funtionality of foreign keys. Without it >FKs don't make much sense at all. > > >sql, query yada yada ... -- Paul DuBois http://www.kitebird.com/ sql, query