Bug #9057 Incorrect errormsg for too-large char field in table definition
Submitted: 8 Mar 2005 21:54 Modified: 13 Apr 2005 2:40
Reporter: Arjen Lentz Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0./5.0 OS:Any (any)
Assigned to: Alexander Barkov CPU Architecture:Any

[8 Mar 2005 21:54] Arjen Lentz
Description:
Trying to create a char column that's too large (>255) generates an error msg.
CREATE TABLE t (s CHAR(2000));
ERROR 1074 (42000): Column length too big for column 's' (max = 255); use BLOB instead

This is of course incorrect. It should say TEXT not BLOB.

The above just confuses the user - why would a char field suddenly need to be a blob... makes no sense at all.

How to repeat:
See description.

Suggested fix:
Fix error message.
[8 Mar 2005 22:10] MySQL Verification Team
Verified and changing version.

mysql> CREATE TABLE t (s CHAR(2000));
Query OK, 0 rows affected, 1 warning (0.10 sec)

mysql> show warnings;
+---------+------+-----------------------------------------+
| Level   | Code | Message                                 |
+---------+------+-----------------------------------------+
| Warning | 1246 | Converting column 's' from CHAR to TEXT |
+---------+------+-----------------------------------------+
1 row in set (0.01 sec)

mysql> select version();
+-----------+
| version() |
+-----------+
| 4.1.10-nt |
+-----------+
1 row in set (0.02 sec)

mysql> CREATE TABLE t (s CHAR(2000));
ERROR 1074 (42000): Column length too big for column 's' (max = 255); use BLOB instead
mysql> select version();
+-------------------+
| version()         |
+-------------------+
| 5.0.3-alpha-debug |
+-------------------+
1 row in set (0.01 sec)

mysql> CREATE TABLE t (s CHAR(2000));
ERROR 1074: Too big column length for column 's' (max = 255). Use BLOB instead
mysql> select version();
+------------------+
| version()        |
+------------------+
| 4.0.24-debug-log |
+------------------+
1 row in set (0.08 sec)
[15 Mar 2005 6:38] Alexander Barkov
A proposal is to fix to display:

"use a TEXT or BLOB column type instead"
[29 Mar 2005 14:06] Alexander Barkov
It now writes "...; Use BLOB or TEXT instead".
[13 Apr 2005 2:40] Paul DuBois
No documentation need. (Change in behavior
is very minor.)