Bug #40332 Warning for table comment with too many characters is not descriptive
Submitted: 26 Oct 2008 0:14 Modified: 18 May 2010 21:04
Reporter: Christopher Jerdonek Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.0.67-community-nt\5.1 OS:Windows (XP)
Assigned to: CPU Architecture:Any
Tags: comment, error, table, too long, too many, UNKNOWN

[26 Oct 2008 0:14] Christopher Jerdonek
Description:
If you alter a table with a comment that is too long (i.e. it exceeds the 60 character limit), MySQL issues an unknown warning rather than a descriptive warning:

Code: 1105 (ER_UNKNOWN_ERROR) 
Message: Unknown error

How to repeat:
Create a table:

DROP DATABASE IF EXISTS `test333`;
CREATE DATABASE `test333`;
CREATE TABLE `test333`.`table` (
  `id` INTEGER UNSIGNED NOT NULL DEFAULT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
)
ENGINE = InnoDB;

And then execute the following query which issues an unknown warning:

ALTER TABLE `test333`.`table` COMMENT = '1111111111222222222233333333334444444444555555555566666666667';

Suggested fix:
The warning should say something like: "Table comment truncated: comment exceeded limit of 60 characters."
[26 Oct 2008 0:30] MySQL Verification Team
Thank you for the bug report.

c:\dbs>c:\dbs\5.0\bin\mysql -uroot --port=3500 --prompt="mysql 5.0 > "
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.72-nt-debug-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql 5.0 > use test
Database changed
mysql 5.0 > DROP DATABASE IF EXISTS `test333`;
Query OK, 0 rows affected, 1 warning (0.05 sec)

mysql 5.0 > CREATE DATABASE `test333`;
Query OK, 1 row affected (0.00 sec)

mysql 5.0 > CREATE TABLE `test333`.`table` (
    ->   `id` INTEGER UNSIGNED NOT NULL DEFAULT NULL AUTO_INCREMENT,
    ->   PRIMARY KEY (`id`)
    -> )
    -> ENGINE = InnoDB;
Query OK, 0 rows affected (0.20 sec)

mysql 5.0 > ALTER TABLE `test333`.`table` COMMENT =
    -> '1111111111222222222233333333334444444444555555555566666666667';
Query OK, 0 rows affected, 1 warning (0.13 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql 5.0 > show warnings;
+---------+------+---------------+
| Level   | Code | Message       |
+---------+------+---------------+
| Warning | 1105 | Unknown error |
+---------+------+---------------+
1 row in set (0.00 sec)

mysql 5.0 >
[18 May 2010 20:58] Hartmut Holzgraefe
returns a proper warning in current 5.1.46 just fine:

mysql> create table t1 (id int) comment="asghasdghasdghasguhasghasguhasdguhasdghasdghasghasghasghasghasdghasdghasdghasdhasdhasdghasdghasdgh";
Query OK, 0 rows affected, 1 warning (1.05 sec)

mysql> show warnings;
+---------+------+-----------------------------------------------+
| Level   | Code | Message                                       |
+---------+------+-----------------------------------------------+
| Warning | 1629 | Comment for table 't1' is too long (max = 60) |
+---------+------+-----------------------------------------------+
1 row in set (0.00 sec)

mysql> alter table t1 comment="asghasdghasdghasguhasghasguhasdguhasdghasdghasghasghasghasghasdghasdghasdghasddogajsdgsdgidiiiasdgiasdgiasdgiasdi";
Query OK, 0 rows affected, 1 warning (1.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> show warnings;
+---------+------+--------------------------------------------------------+
| Level   | Code | Message                                                |
+---------+------+--------------------------------------------------------+
| Warning | 1629 | Comment for table '#sql-5438_8' is too long (max = 60) |
+---------+------+--------------------------------------------------------+
1 row in set (0.00 sec)
[18 May 2010 21:04] Hartmut Holzgraefe
For the wrong table name in the ALTER message see bug #48077