Bug #12793 Problem using CREATE TABLE
Submitted: 25 Aug 2005 1:45 Modified: 25 Aug 2005 2:45
Reporter: Carlos Focosi Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.11 OS:Microsoft Windows (Windows XP)
Assigned to: Lachlan Mulcahy CPU Architecture:Any

[25 Aug 2005 1:45] Carlos Focosi
Description:
I am receiving the following error message when trying to create table: 

Error= SQL=Specified key was too long; max key length is 1000 bytes:
- - - - - - - - - -

How to repeat:
CREATE TABLE `mos_core_acl_aro` (
  `aro_id` int(11) NOT NULL auto_increment,
  `section_value` varchar(240) NOT NULL default '0',
  `value` varchar(240) NOT NULL default '',
  `order_value` int(11) NOT NULL default '0',
  `name` varchar(255) NOT NULL default '',
  `hidden` int(11) NOT NULL default '0',
  PRIMARY KEY  (`aro_id`),
  UNIQUE KEY `section_value_value_aro` (`section_value`,`value`),
  UNIQUE KEY `mos_gacl_section_value_value_aro` (`section_value`,`value`),
  KEY `hidden_aro` (`hidden`),
  KEY `mos_gacl_hidden_aro` (`hidden`)
) TYPE=MyISAM
[25 Aug 2005 2:45] Lachlan Mulcahy
The behaviour you experience is not a bug..

You are using a mutli-byte character set like utf8. This means that each character in your VARCHAR fields may actually consume between one and three bytes. Therefore the key length could be larger than 1000 bytes.

You will need to reduce the length of your fields or use a non-multi-byte character set.

Also, strangely your 'section_value_value_aro' and 'mos_gacl_section_value_value_aro' keys are identical as well as your 'hidden_aro', 'mos_gacl_hidden_aro' keys.
[25 Aug 2005 6:42] Andrey Hristov
Unreproducable under Linux (5.0.12)