Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

BUILD ERROR - index too big not using regex length 16 Oct 2012 22:03 #4599

  • JoomGuy
  • JoomGuy's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Hi @admin,

I'm getting an error on installing a component I'm working on com_jstoresocial.
The Error
JInstaller: :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 `vs4go_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 `vs4go_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
^[A-Z0-9]{2,10}$

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
  1. Joomla Version: 2.5
  2. Environment: Sandbox
  3. Cook Version: 2.0
  4. JS: JQuery
  5. Form Style: Condensed
  6. Features: Maximum
  7. ToDo: No
  8. DB Automation: Model
  9. Timeout: 20 secs
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

Please Log in or Create an account to join the conversation.

Re: BUILD ERROR - index too big not using regex length 16 Oct 2012 22:31 #4601

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Because, you might write your varchar size in the correct property : Length
Coding is now a piece of cake
The following user(s) said Thank You: JoomGuy

Please Log in or Create an account to join the conversation.

[FIXED] BUILD ERROR -index too big not using regex 16 Oct 2012 22:34 #4602

  • JoomGuy
  • JoomGuy's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
the only issue is, when I write that in length, it auto-creates the regex defining only the length defined. That way, I can't also specify alphanumeric chars, right? *****EDIT WRONG!!!

Yes, OK I get it... Just need to update the handler and expression again after specifying the length property!
END EDIT******

Thanks,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

Please Log in or Create an account to join the conversation.

Last edit: by JoomGuy. Reason: [fixed]
  • Page:
  • 1
Time to create page: 0.063 seconds

I'm playing around with the new mvc and the FORK feature is FANTASTIC!!! it's saving me a lot of time! you are doing a very good job!!

Tomaselli (Forum)  

Get Started