List:General Discussion« Previous MessageNext Message »
From:Tom Worster Date:January 25 2010 3:32pm
Subject:RE: auto increment without primary key in innodb
?
View as plain text  
it's not an innodb thing:

http://dev.mysql.com/doc/refman/5.0/en/create-table.html

"Note
"There can be only one AUTO_INCREMENT column per table, it must be indexed, and it cannot
have a DEFAULT value. An AUTO_INCREMENT column works properly only if it contains only
positive values. Inserting a negative number is regarded as inserting a very large
positive number. This is done to avoid precision problems when numbers “wrap”
over from positive to negative and also to ensure that you do not accidentally get an
AUTO_INCREMENT column that contains 0."

-----Original Message-----
From: "Yang Zhang" <yanghatespam@stripped>
Sent: Monday, January 25, 2010 10:21am
To: mysql@stripped
Subject: auto_increment without primary key in innodb?

In innodb, is it possible to have an auto_increment field without
making it a (part of a) primary key? Why is this a requirement? I'm
getting the following error. Thanks in advance.

ERROR 1075 (42000): Incorrect table definition; there can be only one
auto column and it must be defined as a key
-- 
Yang Zhang
http://www.mit.edu/~y_z/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=1



Thread
auto_increment without primary key in innodb?Yang Zhang25 Jan
  • RE: auto increment without primary key in innodb?Tom Worster25 Jan
    • Re: auto_increment without primary key in innodb?Yang Zhang25 Jan
      • Re: auto_increment without primary key in innodb?Jaime Crespo Rinc√≥n25 Jan
      • Re: auto_increment without primary key in innodb?Paul DuBois25 Jan
  • Re: auto_increment without primary key in innodb?Yong Lee26 Jan
    • Re: auto_increment without primary key in innodb?Johan De Meersman26 Jan