Bug #4649 | Foreign key does not work with special letters | ||
---|---|---|---|
Submitted: | 20 Jul 2004 15:54 | Modified: | 30 Jul 2004 17:52 |
Reporter: | André Lehmann | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
Version: | 4.1.3 | OS: | |
Assigned to: | Marko Mäkelä | CPU Architecture: | Any |
[20 Jul 2004 15:54]
André Lehmann
[29 Jul 2004 19:15]
Shuichi Tamagawa
The same problem with Japanese Characters. mysql>CREATE TABLE PARENT( -> `?e` INT NOT NULL, -> PRIMARY KEY (`?e`) -> ) ENGINE = INNODB; Query OK, 0 rows affected (0.18 sec) mysql>CREATE TABLE child( -> `?e` INT NOT NULL, -> child_id INT NOT NULL, -> PRIMARY KEY (`?e`,child_id), -> FOREIGN KEY (`?e`) REFERENCES parent(`?e`) ON DELETE CASCADE -> ) ENGINE = INNODB; ERROR 1005 (HY000): Can't create table '.\test\child.frm' (errno: 150) Note: This comment can be viewed in SJIS encoding.
[30 Jul 2004 15:24]
Marko Mäkelä
InnoDB parses the foreign key constraints from the query string itself. The query string would be in the original character set, while the table names are in UTF-8. Converting the query string into UTF-8 before passing it to the InnoDB parser appears to solve the problem, at least when using latin1. ChangeSet@1.1942, 2004-07-30 16:08:19+03:00, marko@hundin.mysql.fi ha_innodb.cc: ha_innobase::create(): pass the query string as UTF-8 to row_table_add_foreign_constraints() (Bug #4649)
[30 Jul 2004 15:53]
Marko Mäkelä
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bugfix, yourself. More information about accessing the source trees is available at http://www.mysql.com/doc/en/Installing_source_tree.html