Bug #47667 | Improve ERROR 1005/150 message when trying to create a TEMPORARY table with a FK | ||
---|---|---|---|
Submitted: | 28 Sep 2009 4:18 | Modified: | 28 Sep 2009 6:04 |
Reporter: | Roel Van de Paar | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S4 (Feature request) |
Version: | 5.1.37 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[28 Sep 2009 4:18]
Roel Van de Paar
[28 Sep 2009 4:27]
Roel Van de Paar
Not a bug. FOREIGN KEY Constraints are not allowed for TEMPORARY tables. 'Both tables must be InnoDB tables and they must not be TEMPORARY tables.' http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html
[28 Sep 2009 4:34]
Roel Van de Paar
A non-existing table reference: CREATE TABLE child (id INT, parent_id INT, INDEX par_ind (parent_id), FOREIGN KEY (parent_id) REFERENCES nonexisting(id) ON DELETE CASCADE) ENGINE=INNODB; Gives the same error: ERROR 1005 (HY000): Can't create table 'roelt.child' (errno: 150) (perror 150: Foreign key constraint is incorrectly formed) It may be good to make the error in the original situation somewhat clearer. Something like: mysql> CREATE TEMPORARY TABLE child (id INT, parent_id INT, INDEX par_ind (parent_id), FOREIGN KEY (parent_id) REFERENCES parent(id) ON DELETE CASCADE) ENGINE=INNODB; ERROR 1005 (HY000): Can't create table 'roelt.child'. FOREIGN KEY Constraints are not allowed on TEMPORARY TABLES (errno: nnn) With a new perror number.
[28 Sep 2009 6:04]
Valeriy Kravchuk
Thank you for the feature request.