Bug #45987 ERROR 1075 (42000): Incorrect table definition
| Submitted: | 7 Jul 2009 4:15 | Modified: | 7 Aug 2009 1:11 |
|---|---|---|---|
| Reporter: | Ender Li | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Documentation | Severity: | S3 (Non-critical) |
| Version: | 5.1.36-community | OS: | Windows (XP Pro) |
| Assigned to: | Paul DuBois | CPU Architecture: | Any |
| Tags: | 1075, 42000, auto_increment, error, reference | ||
[7 Jul 2009 4:15]
Ender Li
[7 Jul 2009 5:48]
Valeriy Kravchuk
Thank you for the problem report. Actually, this is not a server bug, just a difference between MyISAM (assumed as default by that manual page) and InnoDB storage engine documented elsewhere (http://dev.mysql.com/doc/refman/5.1/en/innodb-auto-increment-handling.html). You (and me) have InnoDB as a default storage engine instead. Look: mysql> CREATE TABLE animals ( -> grp ENUM('fish','mammal','bird') NOT NULL, -> id MEDIUMINT NOT NULL AUTO_INCREMENT, -> name CHAR(30) NOT NULL, -> PRIMARY KEY (grp,id) -> ); ERROR 1075 (42000): Incorrect table definition; there can be only one auto colum n and it must be defined as a key mysql> CREATE TABLE animals ( -> grp ENUM('fish','mammal','bird') NOT NULL, -> id MEDIUMINT NOT NULL AUTO_INCREMENT, -> name CHAR(30) NOT NULL, -> PRIMARY KEY (grp,id) -> ) engine=MyISAM; Query OK, 0 rows affected (0.20 sec) mysql> alter table animals engine=InnoDB; ERROR 1075 (42000): Incorrect table definition; there can be only one auto colum n and it must be defined as a key So, this page in documentation should be clarified.
[7 Aug 2009 1:11]
Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products. Added an explicit ENGINE=MyISAM clause to the CREATE TABLE statement.
[10 Feb 2011 22:06]
MySQL Verification Team
Bug: http://bugs.mysql.com/bug.php?id=60104 marked as duplicate of this one.
[23 Jun 2012 14:38]
joel torres
only twist the position of PRIMARY KEY (grp,id) to PRIMARY KEY (id, grp) and solved problem...
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.053 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.