Bug #9502 Not Null Unique fails with error 1071
Submitted: 30 Mar 2005 22:58 Modified: 19 Apr 2005 10:16
Reporter: edmond melkomian Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:4.1.10 OS:Linux (Red hat Linux 4)
Assigned to: Martin Skold CPU Architecture:Any

[30 Mar 2005 22:58] edmond melkomian
Description:
When trying to create a table in a cluster environment that has a unique not null key, the error is 

mysql> create table xxx (col1 varchar(255) not null unique) engine=ndbcluster;
ERROR 1071 (42000): Specified key was too long; max key length is 255 bytes

I tried reducing the size, and at varchar 85 there is no problem.
mysql> create table xxx (col1 varchar(85) not null unique) engine=ndbcluster;   Query OK, 0 rows affected (0.60 sec)

I tested this with a non clustered table, and it was fine. 

Thanks,
Edmond Melkomian

How to repeat:
mysql> create table xxx (col1 varchar(255) not null unique) engine=ndbcluster;
[30 Mar 2005 23:40] Jorge del Conde
tested w/4.1.11 from bk
[19 Apr 2005 10:16] Martin Skold
Can't repeat on latest 4.1 src tree:
create table xxx (col1 varchar(255) not null unique) engine=ndbcluster;
Query OK, 0 rows affected (0.56 sec)
 
mysql> show table status;
+------+------------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+-------------------+----------+----------------+---------+
| Name | Engine     | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation         | Checksum | Create_options | Comment |
+------+------------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+-------------------+----------+----------------+---------+
| xxx  | ndbcluster |       9 | Dynamic    |    0 |              0 |           0 |            NULL |            0 |         0 |           NULL | NULL        | NULL        | NULL       | latin1_swedish_ci |     NULL |                |         |
+------+------------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+-------------------+----------+----------------+---------+
1 row in set (0.05 sec)

Either bug is fixed or you are using a character set that uses more bytes per character.