Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  foreign_sql_mode.result   Sprache: Lisp

 

call mtr.add_suppression("InnoDB: In ALTER TABLE .* has or is referenced in foreign key constraints which are not compatible with the new table definition.");
# modify child column NOT NULL on UPDATE CASCADE..parent column NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE CASCADE)ENGINE=InnoDB;
ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL;
ERROR HY000: Column 'f1' cannot be NOT NULL: needed in a foreign key constraint '1' SET NULL
INSERT INTO t1 VALUES(1, 1);
INSERT INTO t2 VALUES(1);
UPDATE t1 SET f2= NULL;
DELETE FROM t2;
SELECT * FROM t1;
f1 f2
1 NULL
UPDATE t1 SET f2 = NULL;
SELECT * FROM t1;
f1 f2
1 NULL
DROP TABLE t2, t1;
# modify child column NOT NULL ON UPDATE SET NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY(f1) REFERENCES t1(f1) ON UPDATE SET NULL)ENGINE=InnoDB;
ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL;
ERROR HY000: Column 'f1' cannot be NOT NULL: needed in a foreign key constraint '1' SET NULL
INSERT INTO t1 VALUES(1, 1);
INSERT INTO t2 VALUES(1, 1);
UPDATE t1 SET f1= 2;
SELECT * FROM t2;
f1 f2
NULL 1
DROP TABLE t2, t1;
# modify child column NOT NULL ON DELETE SET NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE SET NULL)ENGINE=InnoDB;
ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL;
ERROR HY000: Column 'f2' cannot be NOT NULL: needed in a foreign key constraint '1' SET NULL
DROP TABLE t2, t1;
# modify parent column NULL ON UPDATE CASCADE child column NOT NULL
CREATE TABLE `t#1`(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE `t#2`(f1 INT NOT NULL,
FOREIGN KEY(f1) REFERENCES `t#1`(f2)
ON UPDATE CASCADE)ENGINE=InnoDB;
ALTER TABLE `t#1` MODIFY COLUMN f2 INT;
ERROR HY000: Cannot change column 'f2': used in a foreign key constraint '1' of table 'test.t#2'
INSERT INTO `t#1` VALUES(1, 1);
INSERT INTO `t#2` VALUES(1);
UPDATE `t#1` SET f2= NULL;
ERROR 23000: Column 'f2' cannot be null
DELETE FROM `t#2`;
SELECT * FROM `t#1`;
f1 f2
1 1
DROP TABLE `t#2`, `t#1`;
CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT,
f2 INT DEFAULT NULL,
PRIMARY KEY(f1),
FOREIGN KEY(f2) REFERENCES t1(f1))ENGINE=InnoDB;
CREATE TABLE t2 (f1 INT NOT NULL,
f2 INT NOT NULL,
f3 INT DEFAULT NULL,
PRIMARY KEY(f1, f2),
FOREIGN KEY(f2, f3) REFERENCES t1(f2, f1)
ON UPDATE CASCADE)ENGINE=InnoDB;
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t1;

Messung V0.5 in Prozent
C=44 H=100 G=77

¤ Dauer der Verarbeitung: 0.8 Sekunden  (vorverarbeitet am  2026-10-08) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1126438
#Domains=1897691