MySQL Forums
Forum List  »  NDB clusters

ERROR 1071 (42000): Specified key was too long; max key length is 255 bytes
Posted by: Weidong Tang
Date: February 07, 2006 09:37AM

I got "ERROR 1071 (42000): Specified key was too long; max key length is 255 bytes" when I create a table in cluster env (Linux, MySQL 4.1). The same create table works fine for ENGINE=InnoDB;

Is the varchar not aloowed to be a key in cluster env?

Thanks ahead for any helps;

Weidong

>> 1.1: Here is the table creation script for NDBCLUSTER:
DROP TABLE IF EXISTS `identitytable`;
CREATE TABLE `identitytable` (
`SellerId` smallint(5) NOT NULL default '0',
`BuyerId` varchar(128) NOT NULL default '',
PRIMARY KEY (`SellerId`,`BuyerId`)
) ENGINE=NDBCLUSTER DEFAULT CHARSET=utf8;

>> 1.2: here is the screen dump for the error:
mysql> CREATE TABLE `identitytable` (
-> `SellerId` smallint(5) NOT NULL default '0',
-> `BuyerId` varchar(128) NOT NULL default '',
-> PRIMARY KEY (`SellerId`,`BuyerId`)
-> ) ENGINE=NDBCLUSTER DEFAULT CHARSET=utf8;
ERROR 1071 (42000): Specified key was too long; max key length is 255 bytes
mysql>

>> 2.1: Here is the table creation script:
DROP TABLE IF EXISTS `identitytable`;
CREATE TABLE `identitytable` (
`SellerId` smallint(5) NOT NULL default '0',
`BuyerId` varchar(128) NOT NULL default '',
PRIMARY KEY (`SellerId`,`BuyerId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

>> 2.2: here is the screen dump for InnoDB:
mysql> CREATE TABLE `identitytable` (
-> `SellerId` smallint(5) NOT NULL default '0',
-> `BuyerId` varchar(128) NOT NULL default '',
-> PRIMARY KEY (`SellerId`,`BuyerId`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.20 sec)

>> 2.3: here is the screen dump of error for ALTER to NDBCLUSTER:
mysql> ALTER TABLE identitytable ENGINE=NDBCLUSTER
-> ;
ERROR 1071 (42000): Specified key was too long; max key length is 255 bytes
mysql>

Options: Reply• Quote


Subject
Views
Written By
Posted
ERROR 1071 (42000): Specified key was too long; max key length is 255 bytes
7413
February 07, 2006 09:37AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.