Exakte Bedeutung des MySQL-Fremdschlüssels 'on delete restricte' Klausel

Ich habe zwei MySQL-Tabellen: collections und privacy_level.
Ich definiere Sie mit einem foreign key Beziehung als solche:

CREATE TABLE collections (
  coll_id smallint NOT NULL AUTO_INCREMENT UNSIGNED,
  name varchar(30) NOT NULL,
  privacy tinyint NOT NULL UNSIGNED DEFAULT '0',
  PRIMARY KEY(coll_id),
  INDEX(privacy),
  FOREIGN KEY fk_priv (privacy) REFERENCES privacy_level (level) ON UPDATE CASCADE ON DELETE RESTRICT
) ENGINE=InnoDB;  

 CREATE TABLE privacy_level (
   level tinyint NOT NULL UNSIGNED,
   name varchar(20) NOT NULL,
   PRIMARY KEY (level)
 ) ENGINE InnoDB;  

Meine Frage ist über die ON DELETE RESTRICT - Klausel und ich konnte nicht ableiten, die Antwort aus dem online-Handbuch oder eine google-Suche.

Bedeutet das, dass ich nie löschen einer Zeile aus privacy_level?
Oder bedeutet es, dass ich nicht löschen einer Zeile aus privacy_level wenn eine Reihe von collections.privacy hat einen Wert, der der gleiche wie ein Wert in privacy_level.level?

Ist, wenn privacy_level hat level = 2name = 'top secret' aber kein Eintrag in Sammlungen.Privatsphäre hat privacy = 2lösche ich den level = 2name = 'top secret' Eintrag? Oder ist es verboten auf eine Spalte breiter?

Vielen Dank für jede Einsicht.

InformationsquelleAutor der Frage Donkey Trouble | 2011-11-09

Schreibe einen Kommentar