Bug #10482 | Unable to change lengths of binary columns associated with foreign key | ||
---|---|---|---|
Submitted: | 9 May 2005 15:26 | Modified: | 11 May 2005 7:43 |
Reporter: | Bill Jones | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S1 (Critical) |
Version: | 4.0.17 | OS: | Windows (Windows XP) |
Assigned to: | CPU Architecture: | Any |
[9 May 2005 15:26]
Bill Jones
[9 May 2005 17:05]
MySQL Verification Team
mysql> use han; Database changed mysql> CREATE TABLE `animal` ( -> `id` varchar(255) binary NOT NULL default '', -> PRIMARY KEY (`id`) -> ) TYPE=InnoDB; Query OK, 0 rows affected (0.02 sec) mysql> mysql> INSERT INTO animal VALUES ('dog'); Query OK, 1 row affected (0.01 sec) mysql> mysql> CREATE TABLE `pet` ( -> `animal_id` varchar(255) binary NOT NULL default '', -> `pet_name` varchar(255) NOT NULL, -> PRIMARY KEY (`animal_id`), -> CONSTRAINT `animal_id_fk` FOREIGN KEY (`animal_id`) REFERENCES `animal` -> (`id`) -> ) TYPE=InnoDB; Query OK, 0 rows affected (0.05 sec) mysql> mysql> INSERT INTO pet VALUES ('dog', 'Rover'); Query OK, 1 row affected (0.00 sec) mysql> SET FOREIGN_KEY_CHECKS = 0; Query OK, 0 rows affected (0.00 sec) mysql> alter table `pet` modify animal_id varchar(100) not null; ERROR 1025: Error on rename of './han/#sql-4f5_2' to './han/pet' (errno: 150) mysql>
[11 May 2005 7:43]
Heikki Tuuri
Bill, the collation order of the referenced and the referencing column must be the same. You cannot change VARCHAR ... BINARY to an ordinary VARCHAR because the collation order would be different. Regards, Heikki