Bug #8598 innodb with autoindex on multicol prim key

Submitted: 18 Feb 2005 12:08 Modified: 13 May 2010 16:04
Reporter: Andre Justus Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S4 (Feature request)
Version:4.1.x OS:Linux (debian)
Assigned to: Assigned Account CPU Architecture:Any

[18 Feb 2005 12:08] Andre Justus
Description:
I don't know if it is a bug or if the following behavior is wanted.

when having myisam, i can have a primary index, including 2 colums
and an autoindex on the second colum of the primary
when having innodb, the autoindex have to be on the first cloum of the primary

I Have this tables:

CREATE TABLE `test` (
  `set_id` smallint(5) unsigned NOT NULL default '0',
  `id` tinyint(4) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY  (`set_id`,`id`)
) ENGINE=myisam DEFAULT CHARSET=latin1
[it works]

CREATE TABLE `test` (
  `set_id` smallint(5) unsigned NOT NULL default '0',
  `id` tinyint(4) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY  (`set_id`,`id`)
) ENGINE=innodb DEFAULT CHARSET=latin1
[it does not work]

CREATE TABLE `test` (
  `set_id` smallint(5) unsigned NOT NULL default '0',
  `id` tinyint(4) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY  (`id`,`set_id`)
) ENGINE=innodb DEFAULT CHARSET=latin1
[it works]

How to repeat:
CREATE TABLE `test` (
  `set_id` smallint(5) unsigned NOT NULL default '0',
  `id` tinyint(4) unsigned NOT NULL auto_increment,
  PRIMARY KEY  (`set_id`,`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

 ALTER TABLE `test` TYPE = INNODB
#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key 

 CREATE TABLE `test` (
`set_id` smallint( 5 ) unsigned NOT NULL default '0',
`id` tinyint( 4 ) unsigned NOT NULL AUTO_INCREMENT ,
PRIMARY KEY ( `set_id` , `id` )
) ENGINE = innodb DEFAULT CHARSET = latin1 

doestn't work too

CREATE TABLE `test` (
  `set_id` smallint(5) unsigned NOT NULL default '0',
  `id` tinyint(4) unsigned NOT NULL,
  PRIMARY KEY  (`set_id`,`id`)
) ENGINE=innodb DEFAULT CHARSET=latin1

works
[18 Feb 2005 12:11] Andre Justus
sorry, please ignore or delete the 'how to repeat' part
[18 Feb 2005 14:13] Heikki Tuuri
Hi!

This is a feature request. I have assigned Jan Lindström for this feature request. We might get this feature to 5.2 or 6.0.

Regards,

Heikki
[8 Jun 2005 8:20] Andre Justus
changed Severity to feature request

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.050 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.