Bug #7417 VARCHAR(65535) doesn't work.
Submitted: 20 Dec 2004 0:16 Modified: 6 May 2005 15:18
Reporter: Paul DuBois Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.3 OS:
Assigned to: Ramil Kalimullin CPU Architecture:Any

[20 Dec 2004 0:16] Paul DuBois
Description:
In 5.0.3, VARCHAR now is supposed to allow
column lengths up to 65535.  It appears that
the maximum usable length is 65532:

mysql> create table t (c varchar(65535));
ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not 
counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
mysql> create table t (c varchar(65534));
ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not 
counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
mysql> create table t (c varchar(65533));
ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not 
counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
mysql> create table t (c varchar(65532));
Query OK, 0 rows affected (0.03 sec)

The manual doesn't state that VARBINARY also should allow
a length up to 65535, but assuming that it should, VARBINARY
also fails in a similar way:

mysql> drop table t;
Query OK, 0 rows affected (0.01 sec)

mysql> create table t (c varbinary(65535));
ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not 
counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
mysql> create table t (c varbinary(65534));
ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not 
counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
mysql> create table t (c varbinary(65533));
ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not 
counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
mysql> create table t (c varbinary(65532));
Query OK, 0 rows affected (0.00 sec)

How to repeat:
See above.
[20 Dec 2004 9:26] Hartmut Holzgraefe
sql/handler.h currently limits the total row length to 
HA_MAX_REC_LENGTH (65535) bytes

uint max_record_length() const
  { return min(HA_MAX_REC_LENGTH, max_supported_record_length()); }
[6 May 2005 15:17] Trudy Pelzer
Per above comment and discussions with Paul,
this is not a bug because it is legitimate for
a portion of the allowed length for a VARCHAR
column to be utilized for internal storage 
information.

See also bug #8295 for additional details.