Needs work
Project:
Document Import API
Version:
6.x-2.0-alpha2
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Jul 2008 at 23:46 UTC
Updated:
13 Oct 2010 at 01:38 UTC
I get this when enabling the module:
user warning: Specified key was too long; max key length is 1000 bytes query: CREATE TABLE docapi_library ( `doc_id` INT unsigned NOT NULL auto_increment, `plugin_id` INT unsigned NOT NULL, `uid` INT unsigned NOT NULL, `filemime` VARCHAR(255) NOT NULL DEFAULT 'text/plain', `filename` VARCHAR(255) NOT NULL DEFAULT '', `filepath` VARCHAR(255) NOT NULL, `filesize` INT unsigned NOT NULL, `created` DATETIME NOT NULL, `changed` DATETIME NOT NULL, PRIMARY KEY (doc_id), INDEX filepathfilename (filepath, filename) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in /Applications/MAMP/htdocs/soc6x/includes/database.inc on line 509.
Comments
Comment #1
bradfordcp commentedI think this depends on the settings of your MySQL server, but as a precaution I will trim down the length of the name on the key on line 75 of docapi.install. Thanks!
Comment #2
bradfordcp commentedI have created a new release with the fix in place. Please see ALPHA2 located at http://drupal.org/node/280342
Comment #3
agentrickardThis is a weird core limitation of MySQL. I'm surprised we haven't been bitten by it. SchemaAPI might want to handle some of this.
See http://bugs.mysql.com/bug.php?id=4541
Comment #4
agentrickardHere's the corrected schema.
Unless we are not doing lookups on these columns, in which case, the indexes are ot necessary.
Comment #5
webchickI disabled, uninstalled, cvs upped, reinstalled, and same error still.
Comment #6
agentrickardAlpha2 had the same issue. See #4 for a fix. Schema update pending tomorrow.
Comment #7
vojnar commentedThis problem still exists!!!
What do we have to do step by step to fix this issue?
Rgards,
Gabor
Comment #8
adam_b commentedI'm having the same problem using Alpha2 - any progress, please?
Comment #9
the_g_bomb commentedThis is to do with a bug in MySQL. It is listed in bug tracker as a "feature request". http://bugs.mysql.com/bug.php?id=4541 MySQL utf-8 key size bug
The problem is with using utf-8 in MySQL tables. Basically 3 bytes are reserved for every character and the compound key used. As there are 2 keys each requiring 255 characters, it ends up exceeding the maximum size of 1000 bytes set for keys.
The key 'filepath', 'filename' uses 3x (255+255) characters = 1530 bytes.
2 ways to jury rig this to get the module to install:
1. Reduce the lengths for 'filepath' and 'filename' from 255 to 165. Line 46 and 53 in docapi.install. This will mean the total key size will be lower than 1000 bytes (3x (165+165) = 990). (If you really want to you can then go into mysql and change the charset of that table from utf-8 to latin1 and return the sizes back to 255)
2. Change your MySQL config so that the default charset is Latin1 instead of UTF-8