#003891: MYSQL ERROR (#1071) with UTF8 DB on kernel injection

Description:

MYSQL server version:
4.1.2-alpha (latest dev)

This should be easy to reproduce. Though it only happens when you use a utf8 db.

I think it has something todo with the total bytes used for the key.

CREATE DATABASE `test4` DEFAULT CHARACTER SET utf8;

the kernel_schema.sql fails with the following table:

CREATE TABLE eztrigger (
id int(11) NOT NULL auto_increment,
name varchar(255) default NULL,
module_name varchar(200) NOT NULL default ,
function_name varchar(200) NOT NULL default
,
connect_type char(1) NOT NULL default '',
workflow_id int(11) default NULL,
PRIMARY KEY (id),
UNIQUE KEY eztrigger_def_id (module_name,function_name,connect_type),
KEY eztrigger_fetch (name(25),module_name(50),function_name(50))
) TYPE=MyISAM;

Message:
#1071 - Specified key was too long; max key length is 1000 bytes

Suggestion for resolving this bug:
lower the size of module_name and/or function_name

you can assign a max of 334 chars to a key


Environment:

Version: trunk, 3.4 final
PHP Version:
Webserver:
Database:


- Attachments

No attachments for this issue.


- Comments

Was this limit added to MySQL 4.1?

#243228 by Jan Borsodi on June 22nd, 2004 [Permanent Link]

Hi Jan,

I don't know. But my estimate is that this limit existed ever since. It seems that the keys in the uft8 db need just 3 times more bytes then a regular db with a regular charset.

#243229 by Björn Dieding@xrow.de on June 22nd, 2004 [Permanent Link]

Isn't it possible to define some fields or tables to be non-utf8?
This table does not require Unicode at all.

I don't believe the limit is 334 characters since the table insertion works with earlier MySQL versions (unless they changed it).
However they probably have a check for max bytes which is not the same as characters.

It could be a good idea to ask the MySQL guys about this.

#243230 by Jan Borsodi on June 22nd, 2004 [Permanent Link]

Isn't it possible to define some fields or tables to be non-utf8?
This table does not require Unicode at all.
bjoern:
Sure you can define tables to be e.g. latin1. This would solve this issue.

I don't believe the limit is 334 characters since the table insertion works with earlier MySQL versions (unless they changed it).
However they probably have a check for max bytes which is not the same as characters.
Bjoern:
Sure it is calcualted on bytes. The limit of latin would be 1000 characters and the limit for uft8 would be 334 characters.

The main problem I see here is that the eZ Setup won't be able to create the table eztrigger if the the db is setup with utf8.

#243231 by Björn Dieding@xrow.de on June 22nd, 2004 [Permanent Link]

http://bugs.mysql.com/4541url

#243232 by Björn Dieding@xrow.de on July 13th, 2004 [Permanent Link]

Hey Bjorn,

I just ran into this boug.. Did you work out a workaround?

--tony

#243233 by Tony Wood on July 17th, 2004 [Permanent Link]

Hi,

I got it working. I reduced the varchar values to 100 each.. I am sure this will cause problems down the line. For now it works.

#243234 by Tony Wood on July 17th, 2004 [Permanent Link]

I did a feature request on mysql.com. it got derefferred because it was on their todo list (I didn't know).

The reply back from mysql or "Sergei Golubchik" was a little clumsy. I think he didn't fully understand me... what the hell...

But at least we know that this is a issue that will be sovled by mysql itself...

#243235 by Björn Dieding@xrow.de on July 19th, 2004 [Permanent Link]

For reference this bug occurs in MySQL 4.1.3 too.

#243236 by Tony Wood on July 22nd, 2004 [Permanent Link]

Bjorn,

Did your request get accepted into by MySQL?

#243237 by Tony Wood on September 1st, 2004 [Permanent Link]

yes it is on the todo list

that's why i got flamed and blamed :-) for not knowing

#243238 by Björn Dieding@xrow.de on September 1st, 2004 [Permanent Link]

mysql final 4.1(.17) still has this error

I think there is something you should do about it in the installer or change the db kernel.

So if ppl set up mysql with utf8 as default-charset they will be not able to isntall ez with he installer

#243239 by Björn Dieding@xrow.de on November 17th, 2004 [Permanent Link]

I found those lines in the 3.4 to 3.5 upgrade file

-- Reduce the total size of the index eztrigger_def_id to make it work with utf-8
ALTER TABLE eztrigger DROP INDEX eztrigger_def_id;
ALTER TABLE eztrigger ADD UNIQUE INDEX eztrigger_def_id (module_name( 50 ),function_name( 50 ),connect_type);

this means this bug has been resolved! please close.

#243240 by Björn Dieding@xrow.de on February 28th, 2005 [Permanent Link]

his has been fixed in the upgrade scripts but not in the share/db_shema.dba

So the status is still open.

#243241 by Björn Dieding@xrow.de on February 28th, 2005 [Permanent Link]

This must have been fixed in some other way... dn-shema injection works so.. good work close this...

You never know unless you test it.... :-)

#243242 by Björn Dieding@xrow.de on March 1st, 2005 [Permanent Link]

Fixed in eZ publish 3.5.0 .

#243227 by Kåre Køhler Høvik on March 1st, 2005 [Permanent Link]

- History
Properties
Type Bug
Priority Low
Component Misc
Affects Unknown
Fix Version -
Reporter Björn Dieding@xrow.de
Responsible -
Status 0 Closed
Resolution Fixed
Created June 21st, 2004
Updated March 1st, 2005
Resolved March 1st, 2005
 
Navigation [Permanent Link]
Previous Issue
Back to Issues List
Next Issue: #013700
  eZImageAliasHandler bug when Exif contains ComponentsConfiguration