Paul, ----- Original Message ----- From: "Paul DuBois" <[EMAIL PROTECTED]> To: "Heikki Tuuri" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, March 17, 2003 1:05 AM Subject: Re: Foreign Key and default action/RESTRICT behaviour?
> At 23:12 +0200 3/16/03, Heikki Tuuri wrote: > >Tor, > > > >----- Original Message ----- > >From: ""Tor R. Skoglund (NextG)"" <[EMAIL PROTECTED]> > >Newsgroups: mailing.database.mysql > >Sent: Sunday, March 16, 2003 10:11 PM > >Subject: Foreign Key and default action/RESTRICT behaviour? > > > > > Hi List, regarding the foreign key definitions: > >> > >> [CONSTRAINT symbol] FOREIGN KEY (index_col_name, ...) > >> REFERENCES table_name (index_col_name, ...) > >> [ON DELETE {CASCADE | SET NULL | NO ACTION > >> | RESTRICT}] > >> [ON UPDATE {CASCADE | SET NULL | NO ACTION > >> | RESTRICT}] > >> > >> Is there a default action for ON DELETE and ON UPDATE if no action > >> is specified in the database definition? > > > >RESTRICT is, of course, the default 'action'. ON DELETE and ON UPDATE are > >later additions. > > 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. CREATE TABLE parent(id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB; CREATE TABLE child(id INT, parent_id INT, INDEX par_ind (parent_id), FOREIGN KEY (parent_id) REFERENCES parent(id) ) TYPE=INNODB; CREATE TABLE child(id INT, parent_id INT, INDEX par_ind (parent_id), FOREIGN KEY (parent_id) REFERENCES parent(id) ON DELETE RESTRICT ON UPDATE RESTRICT ) TYPE=INNODB; the two definitions of 'child' above are equivalent. RESTRICT simply guards the referential integrity constraint. > 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? ON ... SET DEFAULT is not implemented in InnoDB. > > > >... > > > >> Best regards, > >> Tor Rune Skoglund > >> [EMAIL PROTECTED] > > > >Heikki Tuuri > >Innobase Oy > >--- > >InnoDB - transactions, hot backup, and foreign key support for MySQL > >See http://www.innodb.com, download MySQL-4.0 from http://www.mysql.com > > > -- > Paul DuBois > http://www.kitebird.com/ > sql, query Best regards, Heikki Innobase Oy http://www.innodb.com InnoDB - transactions, foreign keys, and a hot backup tool for MySQL sql query --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php