Bug #18927 "Max key length was too long" is inconsistent.
Submitted: 10 Apr 2006 2:15 Modified: 14 Oct 2008 15:52
Reporter: Baron Schwartz (Basic Quality Contributor) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.0.19-log OS:Linux (Gentoo Linux)
Assigned to: Hartmut Holzgraefe CPU Architecture:Any
Tags: qc

[10 Apr 2006 2:15] Baron Schwartz
Description:
MySQL reports max key length differently when a key is too long.  Sometimes it says 999 bytes, sometimes 1000.

mysql> status;
--------------
mysql  Ver 14.12 Distrib 5.0.19, for pc-linux-gnu (x86_64) using readline 5.1

Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    latin1
Conn.  characterset:    latin1

How to repeat:
mysql> create table test(c varchar(250), d varchar(250),primary key(c,d));
ERROR 1071 (42000): Specified key was too long; max key length is 1000 bytes
mysql> create table test(c varchar(334), d varchar(334), primary key(c,d)); 
ERROR 1071 (42000): Specified key was too long; max key length is 999 bytes
[10 Apr 2006 8:47] Hartmut Holzgraefe
on 4.1 the error message for the 2nd CREATE statement used to be 

  ERROR 1170 (42000): BLOB/TEXT column 'c' used in key specification without a key length

instead
[8 Oct 2008 19:27] Konstantin Osipov
Can't repeat against latest 6.0:
mysql> create table test(c varchar(334), d varchar(334), primary key(c,d)) character set utf8;
ERROR 1071 (42000): Specified key was too long; max key length is 1332 bytes
mysql> create table test(c varchar(250), d varchar(250),primary key(c,d)) character set utf8;
ERROR 1071 (42000): Specified key was too long; max key length is 1332 bytes

Please re-verify. In which version was this fixed?
[14 Oct 2008 15:52] MySQL Verification Team
I couldn't repeat on 5.0 bzr source tree:

mysql> create table test(c varchar(250), d varchar(250),primary key(c,d));
ERROR 1071 (42000): Specified key was too long; max key length is 1000 bytes
mysql> create table test(c varchar(334), d varchar(334), primary key(c,d)); 
ERROR 1071 (42000): Specified key was too long; max key length is 1000 bytes
mysql> show variables like "%version%";
+-------------------------+---------------------+
| Variable_name           | Value               |
+-------------------------+---------------------+
| protocol_version        | 10                  | 
| version                 | 5.0.72-debug        | 
| version_comment         | Source distribution | 
| version_compile_machine | x86_64              | 
| version_compile_os      | unknown-linux-gnu   | 
+-------------------------+---------------------+
5 rows in set (0.00 sec)