List:General Discussion« Previous MessageNext Message »
From:Andreas Date:March 17 2003 4:13am
Subject:Re: Foreign Key and default action/RESTRICT behaviour?
View as plain text  
>> 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.

ON DELETE was implemented because it makes sense and is actually useful 
to safe some work.

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 ...

Thread
Foreign Key and default action/RESTRICT behaviour?NextG)16 Mar
  • Re: Foreign Key and default action/RESTRICT behaviour?Paul DuBois16 Mar
    • Re: Foreign Key and default action/RESTRICT behaviour?Paul DuBois17 Mar
Re: Foreign Key and default action/RESTRICT behaviour?Heikki Tuuri16 Mar
  • Re: Foreign Key and default action/RESTRICT behaviour?Paul DuBois17 Mar
    • Re: Foreign Key and default action/RESTRICT behaviour?Andreas17 Mar
      • Re: Foreign Key and default action/RESTRICT behaviour?Paul DuBois17 Mar
Re: Foreign Key and default action/RESTRICT behaviour?Heikki Tuuri17 Mar