Not the answer you need?
Register and ask your own question!

Percona MySQL 5.6 databases ignoring key length at constrait creation

robothandsrobothands EntrantInactive User Role Beginner
Key too long error:
  
 2015-04-13 11:00:29 26692 [ERROR] Slave SQL: Error 'Specified key was too long; max key length is 767 bytes' [COLOR=#00008B]on query. [COLOR=#00008B]Default [COLOR=#00008B]database: 'dataBaseName'. Query: 'alter table UserGroup add constraint UK_f6x7vpmw83jptft2toy0wsfk6 unique (groupName)', Error_code: 1071  
  
 [code]  
 [COLOR=#00008B]CREATE [COLOR=#00008B]TABLE `UserGroup` (  `id` bigint(20) [COLOR=#00008B]NOT [COLOR=#00008B]NULL AUTO_INCREMENT,  `groupName` varchar(255) CHARACTER [COLOR=#00008B]SET utf8mb4 [COLOR=#00008B]COLLATE utf8mb4_unicode_ci [COLOR=#00008B]NOT [COLOR=#00008B]NULL,  `groupType` int(11) [COLOR=#00008B]NOT [COLOR=#00008B]NULL,  `clientAccountSettings_id` bigint(20) [COLOR=#00008B]DEFAULT [COLOR=#00008B]NULL,  `timestamp4support` timestamp [COLOR=#00008B]NOT [COLOR=#00008B]NULL [COLOR=#00008B]DEFAULT [COLOR=#00008B]CURRENT_TIMESTAMP [COLOR=#00008B]ON [COLOR=#00008B]UPDATE [COLOR=#00008B]CURRENT_TIMESTAMP,  [COLOR=#00008B]PRIMARY [COLOR=#00008B]KEY (`id`),  [COLOR=#00008B]UNIQUE [COLOR=#00008B]KEY `groupName` (`groupName`(191)),  [COLOR=#00008B]KEY `FK8A5BE1545E3F3DC` (`clientAccountSettings_id`),  [COLOR=#00008B]CONSTRAINT `FK8A5BE1545E3F3DC` [COLOR=#00008B]FOREIGN [COLOR=#00008B]KEY (`clientAccountSettings_id`) [COLOR=#00008B]REFERENCES `ClientAccountSettings` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=10 [COLOR=#00008B]DEFAULT CHARSET=utf8 [COLOR=#00008B]COLLATE=utf8_unicode_ci;

 2015-04-13 10:56:25 26692 [ERROR] Slave SQL: Error 'BLOB/TEXT column 'name' used in key specification without a key length' [COLOR=#00008B]on query. [COLOR=#00008B]Default [COLOR=#00008B]database: 'dataBaseName'. Query: 'alter table ISP add constraint UK_tfe1hfqbgydnfe2siovm1i80k unique (name)', Error_code: 1170

Table structure:
[code]
CREATE TABLE `ISP` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `abuseEmail` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `timestamp4support` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`(191)) ) ENGINE=InnoDB AUTO_INCREMENT=465 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.