1CREATE TABLE t1(x VARCHAR(36) DEFAULT NULL, UNIQUE(x)) ENGINE=InnoDB; 2CREATE TABLE t2(y VARCHAR(36) DEFAULT NULL, 3FOREIGN KEY(y) REFERENCES t1(x)) ENGINE=InnoDB; 4INSERT INTO t1 VALUES ("foo"), (NULL), ("bar"); 5INSERT INTO t2 VALUES ("foo"), (NULL), ("bar"); 6SELECT * FROM t1 ORDER BY x ASC; 7x 8NULL 9bar 10foo 11SELECT * FROM t2 ORDER BY y ASC; 12y 13NULL 14bar 15foo 16ALTER TABLE t1 CHANGE COLUMN x x VARCHAR(36) NOT NULL; 17Warnings: 18Warning 1265 Data truncated for column 'x' at row 2 19SELECT * FROM t1; 20x 21 22bar 23foo 24SELECT * FROM t2; 25y 26NULL 27bar 28foo 29DROP TABLE t2, t1; 30CREATE TABLE t1 (x INT PRIMARY KEY) ENGINE=InnoDB; 31CREATE TABLE t2 (y INT PRIMARY KEY, z INT DEFAULT NULL, 32FOREIGN KEY(z) REFERENCES t1(x)) ENGINE=InnoDB; 33INSERT INTO t1 VALUES (0); 34INSERT INTO t2 VALUES (0, NULL); 35ALTER TABLE t2 CHANGE COLUMN z z INT NOT NULL; 36ERROR HY000: Cannot change column 'z': used in a foreign key constraint 't2_ibfk_1' 37DROP TABLE t2, t1; 38