Bug #19861 | [reference_definition] in [column_definition] section of create table statement | ||
---|---|---|---|
Submitted: | 16 May 2006 19:47 | Modified: | 24 May 2006 10:15 |
Reporter: | Sergey Boyko | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
Version: | 5.0.22-BK, 5.0.18 | OS: | Linux (Linux) |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[16 May 2006 19:47]
Sergey Boyko
[16 May 2006 20:59]
Valeriy Kravchuk
Thank you for a bug report. Verified just as described with 5.0.22-BK on Linux: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 5.0.22 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> create table if not exists user_type ( -> id integer not null auto_increment key , -> description varchar (255) not null , -> comments varchar (255) not null -> ) Engine=InnoDB charset=utf8; Query OK, 0 rows affected (0.01 sec) mysql> create table if not exists user ( -> uid integer not null auto_increment key , -> email varchar (255) not null unique , -> user_type integer not null references user_type(id) -> ) Engine=InnoDB charset=utf8; Query OK, 0 rows affected (0.01 sec) mysql> show create table user_type\G *************************** 1. row *************************** Table: user_type Create Table: CREATE TABLE `user_type` ( `id` int(11) NOT NULL auto_increment, `description` varchar(255) NOT NULL, `comments` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 1 row in set (0.00 sec) mysql> show create table user\G *************************** 1. row *************************** Table: user Create Table: CREATE TABLE `user` ( `uid` int(11) NOT NULL auto_increment, `email` varchar(255) NOT NULL, `user_type` int(11) NOT NULL, PRIMARY KEY (`uid`), UNIQUE KEY `email` (`email`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 1 row in set (0.00 sec) So, REFERENCES (unlike FOREIGN KEY) is just ignored for InnoDB tables. It is either a bug or, at least, a documentation request (this "feature", if intended, should be described in http://dev.mysql.com/doc/refman/5.0/en/create-table.html). Now that manual page contains REFERENCE keyword only in 2 places, and none of them explains that it is ignored.
[24 May 2006 10:15]
Heikki Tuuri
Duplicate of http://bugs.mysql.com/bug.php?id=13301