Hi @admin,
I'm getting an error on installing a component I'm working on
com_jstoresocial.
The ErrorJInstaller: :Install: Error SQL DB function failed with error number 1071
Specified key was too long; max key length is 1000 bytes SQL=CREATE TABLE IF NOT EXISTS `[PREFIX]demo6159_products` ( `id` int(11) NOT NULL auto_increment, `params` text NOT NULL DEFAULT '', `title` VARCHAR(255) NOT NULL , `alias` VARCHAR(255) , `category` INT(11) , `product_code` VARCHAR(255) NOT NULL , PRIMARY KEY (`id`), UNIQUE(title, product_code) );
SQL =
CREATE TABLE IF NOT EXISTS `#__demo6159_products` (
`id` int(11) NOT NULL auto_increment,
`params` text NOT NULL DEFAULT '',
`title` VARCHAR(255) NOT NULL ,
`alias` VARCHAR(255) ,
`category` INT(11) ,
`product_code` VARCHAR(255) NOT NULL ,
PRIMARY KEY (`id`),
UNIQUE(title, product_code)
);
Component Install: SQL error file DB function failed with error number 1071
Specified key was too long; max key length is 1000 bytes SQL=CREATE TABLE IF NOT EXISTS `[PREFIX]demo6159_products` ( `id` int(11) NOT NULL auto_increment, `params` text NOT NULL DEFAULT '', `title` VARCHAR(255) NOT NULL , `alias` VARCHAR(255) , `category` INT(11) , `product_code` VARCHAR(255) NOT NULL , PRIMARY KEY (`id`), UNIQUE(title, product_code) );
SQL =
CREATE TABLE IF NOT EXISTS `#__demo6159_products` (
`id` int(11) NOT NULL auto_increment,
`params` text NOT NULL DEFAULT '',
`title` VARCHAR(255) NOT NULL ,
`alias` VARCHAR(255) ,
`category` INT(11) ,
`product_code` VARCHAR(255) NOT NULL ,
PRIMARY KEY (`id`),
UNIQUE(title, product_code)
);
I understand that unique keys can only be 1000 bytes however, I'm limiting the length of the field in question,
product_code to between 2 and 10 alphanumeric (uppercase) chars in a custom regex.
Here's the regex that works perfectly
As you can see in the CREATE TABLE,
product_code is set to VARCHAR(
255) as opposed to the 10 defined in the regex.
Am I right in thinking that for some reason, the maxlength defined in my regex, or indeed any custom regex is not accounted for in the CREATE TABLE statement?
Many thanks!!!
Gez
CONFIG
- Joomla Version: 2.5
- Environment: Sandbox
- Cook Version: 2.0
- JS: JQuery
- Form Style: Condensed
- Features: Maximum
- ToDo: No
- DB Automation: Model
- Timeout: 20 secs