Bug #24773 Error message does not contain enough specifics
Submitted: 2 Dec 2006 10:29 Modified: 3 Dec 2006 10:32
Reporter: Kristian Koehntopp Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Errors Severity:S4 (Feature request)
Version:5.0.18 OS:Linux (Linux 2.6 Kernel)
Assigned to: CPU Architecture:Any
Tags: error message

[2 Dec 2006 10:29] Kristian Koehntopp
Description:
MySQL error messages do not contain enough specifics, specifically the object related to the error is not named. For example, if you run a loader script with many create table statements, you get errors such as

ERROR 1071 (42000): Specified key was too long; max key length is 1000 bytes

but you do not know which of the tables to be created is affected. It is of course possible to work around this by specifiying "-v" or something, but then you get too much output, and only after the fact in a second run.

How to repeat:
Create an invalid load script which for example produces an error such as 1071 and source it:

ERROR 1071 (42000): Specified key was too long; max key length is 1000 bytes

$ cat statistics
CREATE TABLE statistics (url VARCHAR(1024),deviceid INTEGER,createdate INTEGER,accessdate INTEGER,percentage FLOAT,rating INTEGER DEFAULT 0,playcounter INTEGER, uniqueid VARCHAR(32) UNIQUE,deleted BOOL DEFAULT 0,PRIMARY KEY(url, deviceid) );

$ mysql -u root amarok
mysql> source statistics
ERROR 1071 (42000): Specified key was too long; max key length is 1000 bytes

Suggested fix:
All error messages and warnings should at all times name the object and object type to which the error relates. Also, when values are out of range it can be helpful to name the out-of-range values as well as the limit. 

Example:

ERROR 1071 (42000): Table `statistics`: Specified key 1 (`PRIMARY`) was too long (1028 bytes); max key length is 1000 bytes.

This is not just related to this particular error message, it applies to all error messages.
[3 Dec 2006 10:32] Valeriy Kravchuk
I think, this is a reasonable feature request.
[3 Jun 2009 10:06] Sveta Smirnova
There is bug #45290 with similar complain.
[17 Feb 2012 17:52] Sveta Smirnova
Bug #64301 was marked as duplicate of this one. It complains about wrong row count returned for INSERT ON DUPLICATE KEY UPDATE.