Bug #60104 | Compound Primary Key param with Auto_INCREMENT raises ERROR: 1075 | ||
---|---|---|---|
Submitted: | 10 Feb 2011 21:19 | Modified: | 17 Feb 2011 12:24 |
Reporter: | Ralph Bernardes | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S2 (Serious) |
Version: | 5.5, 5.1 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | compound, position, primary key |
[10 Feb 2011 21:19]
Ralph Bernardes
[10 Feb 2011 22:05]
MySQL Verification Team
Thank you for the bug report. Duplicate of bug: http://bugs.mysql.com/bug.php?id=45987. C:\DBS>c:\dbs\5.5\bin\mysql -uroot --port=3540 --prompt="mysql 5.5 >" Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.5.10 Source distribution Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql 5.5 >use d1 Database changed mysql 5.5 >set storage_engine=myisam; Query OK, 0 rows affected (0.00 sec) mysql 5.5 >CREATE TABLE Product( -> Id INT AUTO_INCREMENT NOT NULL, -> Number VARCHAR(10) NOT NULL, -> Description VARCHAR(100), -> PRIMARY KEY(Number, Id) -> ); Query OK, 0 rows affected (0.05 sec) mysql 5.5 > mysql 5.5 >set storage_engine=Innodb; Query OK, 0 rows affected (0.00 sec) mysql 5.5 >drop table Product; Query OK, 0 rows affected (0.00 sec) mysql 5.5 >CREATE TABLE Product( -> Id INT AUTO_INCREMENT NOT NULL, -> Number VARCHAR(10) NOT NULL, -> Description VARCHAR(100), -> PRIMARY KEY(Number, Id) -> ); ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key mysql 5.5 > mysql 5.5 >CREATE TABLE Product( -> Id INT AUTO_INCREMENT NOT NULL, -> Number VARCHAR(10) NOT NULL, -> Description VARCHAR(100), -> PRIMARY KEY(Id, Number) -> ); Query OK, 0 rows affected (0.10 sec) mysql 5.5 >
[17 Feb 2011 12:24]
Ralph Bernardes
What if I need my table to have InnoDB engine? Will I not lose any feature that InnoDB supplies? Like foreign key constraints?