Error during import custom package

Hi,

During the import of the custom package we created, we get the following error:

Error adding index:  Query Failed: ALTER TABLE emails_text ADD INDEX emails_textfromaddr (from_addr): MySQL error 1071: Specified key was too long; max key length is 1000 bytes

and are unable to import successfully. Just one of our customers reported this problem until now. 

Does anybody know what is causing this issue? 

Thanks,

Steven.

  • I believe your package tries to replace the type of field from_addr from varchar to text.

    Is that right?

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • No, that's the strange thing, we do not touch that table.

    When looking into the log file, the error occurs in this context (sorry, can't share the whole file):

    [INFO] Query: SELECT table_name, index_name, non_unique, column_name\nFROM information_schema.statistics WHERE table_schema = ? ORDER BY table_name, index_name, seq_in_index\nParams: ["..."]
    [INFO] Query: SELECT * FROM fields_meta_data WHERE (custom_module = ?) AND (deleted = 0)\nParams: {"1":"ACLActions"}\nTypes: {"1":2}
    [INFO] tableExists: acl_actions
    [INFO] Query: SELECT TABLE_NAME\nFROM INFORMATION_SCHEMA.TABLES\nWHERE TABLE_SCHEMA = ?\n AND TABLE_NAME = ?\n AND TABLE_TYPE = ?\nParams: ["...","acl_actions","BASE TABLE"]
    [INFO] tableExists: acl_actions
    [INFO] Query: SELECT TABLE_NAME\nFROM INFORMATION_SCHEMA.TABLES\nWHERE TABLE_SCHEMA = ?\n AND TABLE_NAME = ?\n AND TABLE_TYPE = ?\nParams: ["...","acl_actions","BASE TABLE"]
    [INFO] Query:DESCRIBE acl_actions
    [INFO] Query Execution Time:0.0013458728790283
    [INFO] Query:DESCRIBE acl_actions
    [INFO] Query Execution Time:0.0011639595031738
    ...
    [INFO] Query: SELECT * FROM fields_meta_data WHERE (custom_module = ?) AND (deleted = 0)\nParams: {"1":"EmailText"}\nTypes: {"1":2}
    [INFO] tableExists: emails_text
    [INFO] Query: SELECT TABLE_NAME\nFROM INFORMATION_SCHEMA.TABLES\nWHERE TABLE_SCHEMA = ?\n AND TABLE_NAME = ?\n AND TABLE_TYPE = ?\nParams: ["...","emails_text","BASE TABLE"]
    [INFO] tableExists: emails_text
    [INFO] Query: SELECT TABLE_NAME\nFROM INFORMATION_SCHEMA.TABLES\nWHERE TABLE_SCHEMA = ?\n AND TABLE_NAME = ?\n AND TABLE_TYPE = ?\nParams: ["...","emails_text","BASE TABLE"]
    [INFO] Query:DESCRIBE emails_text
    [INFO] Query Execution Time:0.0012719631195068
    [INFO] Query:DESCRIBE emails_text
    [INFO] Query Execution Time:0.001248836517334
    [INFO] Query:ALTER TABLE emails_text ADD INDEX emails_textfromaddr (from_addr)
    [INFO] Query Execution Time:0.0011258125305176
    [ALERT] Error adding index: Query Failed: ALTER TABLE emails_text ADD INDEX emails_textfromaddr (from_addr): MySQL error 1071: Specified key was too long; max key length is 1000 bytes
    [WARNING] Security context has active subject during shutdown: {"subject":{"_type":"user","id":"1","_module":"Users","client":{"_type":"bwc-api"}}}
    [INFO] Subject activated: {"_type":"logic-hook","class":"SugarMetric_HookManager","method":"serverRoundTrip"}
    [INFO] Subject deactivated: {"_type":"logic-hook","class":"SugarMetric_HookManager","method":"serverRoundTrip"}

    between line 9 and 11 a lot more tables are scanned, I removed them for clarity

    Also, the error seems to be occurring earlier in the log file before our package is imported. I don't know why it's popping up here.

  • Can you kindly share the content of folder custom/modules/EmailText? Just provide a zip file of such folder.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • This issue is related to mysql version, I guess you need to something do with your charset.

    You may follow this thread.

    sql - Mysql::Error: Specified key was too long; max key length is 1000 bytes - Stack Overflow