Bug #50437 Innodb: Maximum key size limit for 4-byte utf8 is reduced from 255 to 191 chars
Submitted: 19 Jan 2010 10:31 Modified: 25 Jan 2010 20:44
Reporter: Alexander Barkov Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Charsets Severity:S3 (Non-critical)
Version:5.5, 6.1 OS:Any
Assigned to: CPU Architecture:Any

[19 Jan 2010 10:31] Alexander Barkov
Description:
With introducing 4-byte utf8 character set (WL#1213) maximum
possible key length changed from 255 to 191 characters.
So some dumps created in a pre-WL#1213 version will fail to load.

How to repeat:
This can currently be demonstrated in mysql-6.1-glob tree,
but WL#1213 will also be in 5.5 (Celosia) soon:

In mysql-6.1-glob I get the following:

-- varchar(191) works fine
mysql> drop table if exists t1; create table t1 (a varchar(191) primary key) engine=innodb character set utf8; show create table t1;
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

+-------+-----------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                              |
+-------+-----------------------------------------------------------------------------------------------------------+
| t1    | CREATE TABLE `t1` (
  `a` varchar(191) NOT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 | 
+-------+-----------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

-- varchar(192) or longer fails
mysql> drop table if exists t1; create table t1 (a varchar(192) primary key) engine=innodb character set utf8; show create table t1;
Query OK, 0 rows affected (0.00 sec)

ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes
ERROR 1146 (42S02): Table 'test.t1' doesn't exist
mysql> 

Suggested fix:
Fix this definition in include/rem0types.h:

#define REC_MAX_INDEX_COL_LEN	768

to

#define REC_MAX_INDEX_COL_LEN	1024

to make the above CREATE statement work up to varchar(255).
[25 Jan 2010 20:44] Peter Gulutzan
This is a duplicate of
Bug#32915 InnodB: max key length is no longer long enough