Bug #100204 "Specified key was too long" should specify WHICH ONE
Submitted: 13 Jul 2020 14:54 Modified: 15 Jul 2020 23:35
Reporter: teo teo Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Errors Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[13 Jul 2020 14:54] teo teo
Description:
The error message "Specified key was too long" should specify WHICH key was too long. The error can happen in a query that attempts to create more than one key, therefore "specified key" is ambiguous.

How can you be so lazy.

How to repeat:

ALTER TABLE `phrase`
  ADD PRIMARY KEY (`phraseid`),
  ADD UNIQUE KEY `name_lang_type` (`varname`,`languageid`,`fieldname`),
  ADD KEY `languageid` (`languageid`,`fieldname`)

on a table that has all those columns and where some of them does not meet the requirements to create the key

Suggested fix:
MySQL said: 

#1071 - Specified key was too long; max key length is 1000 bytes

Should be:

#1071 - Specified key 'key_name' was too long; max key length is 1000 bytes

or:

#1071 - Specified key for columns ('column1', 'column2') was too long; max key length is 1000 bytes

Oh and by the way, it doesn't say the length either.

Instead of:

"...was too long; max key length is ___ bytes"

it should say:

"...was too long (___bytes); max key length is ___ bytes"
[14 Jul 2020 12:22] MySQL Verification Team
Hi Mr. teo,

Thank you for your bug report.

However, this is not a bug at all. This is how MySQL server is supposed to function.

But, the error message is truly not verbose enough, so it makes an excellent feature request. To implement this feature, new format of the error message is required, hence it can not be done in any production-quality version.

Verified as a feature request.
[15 Jul 2020 23:35] teo teo
> However, this is not a bug at all. This is how MySQL server is
> supposed to function.

> But, the error message is truly not verbose enough

The error message not being verbose enough is exactly the issue I was reporting.

That's why this is not how the server is supposed to function. The server is supposed to give an error message verbose enough when there's an error in the query.

> Verified as a feature request.

I call something wrong that needs to be fixed a bug, not a feature request; but as long as this gets addressed, whatever.