Upon activating the module, I get this error:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes: CREATE TABLE {field_data_field_asset_video_file} ( `entity_type` VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'The entity type this data is attached to', `bundle` VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'The field instance bundle to which this row belongs, used when deleting a field instance', `deleted` TINYINT NOT NULL DEFAULT 0 COMMENT 'A boolean indicating whether this data item has been deleted', `entity_id` INT unsigned NOT NULL COMMENT 'The entity id this data is attached to', `revision_id` INT unsigned NULL DEFAULT NULL COMMENT 'The entity revision id this data is attached to, or NULL if the entity type is not versioned', `language` VARCHAR(32) NOT NULL DEFAULT '' COMMENT 'The language for this data item.', `delta` INT unsigned NOT NULL COMMENT 'The sequence number for this data item, used for multi-value fields', `field_asset_video_file_url` VARCHAR(2048) NULL DEFAULT NULL, `field_asset_video_file_provider` VARCHAR(2048) NULL DEFAULT NULL, `field_asset_video_file_source` VARCHAR(2048) NULL DEFAULT NULL, `field_asset_video_file_snapshot` VARCHAR(255) NULL DEFAULT NULL, PRIMARY KEY (`entity_type`, `entity_id`, `deleted`, `delta`, `language`), INDEX `entity_type` (`entity_type`), INDEX `bundle` (`bundle`), INDEX `deleted` (`deleted`), INDEX `entity_id` (`entity_id`), INDEX `revision_id` (`revision_id`), INDEX `language` (`language`), INDEX `field_asset_video_file_provider` (`field_asset_video_file_provider`), INDEX `field_asset_video_file_source` (`field_asset_video_file_source`), INDEX `field_asset_video_file_url` (`field_asset_video_file_url`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'Data storage for field 15 (field_asset_video_file)'; Array ( ) in db_create_table() (line 2720 of /vagrant/web/includes/database/database.inc).

Related information could be found here: http://stackoverflow.com/questions/1814532/1071-specified-key-was-too-lo...

What's strange, is that it's not the first time I use this module, and never show this. And I don't think index keys names have changed recently right?

Anyone has encountered this, then fixed it?

Thanks,

Cheers,
Jérémy

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jchatard’s picture

So this seems to be related to Innodb which has shorter indexes keys.

Will digg, because I don't want to switch to Mysam

kiseleva.t’s picture

Hi,

I faced with the same problem and it solved for me by attached patch.

IRuslan’s picture

Status: Active » Needs review

  • IRuslan committed 49d2516 on 7.x-1.x
    [#2297897] FIx field sizes for some DB engines.
    
IRuslan’s picture

Status: Needs review » Fixed

Thanks for spotting this issue.
I used a bit different solution, pushed to dev.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

wwhurley’s picture

Status: Closed (fixed) » Needs review
FileSize
545 bytes

Unfortunately this causes the following error (along with stack trace) when installing the module:

exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1170 BLOB/TEXT column 'field_asset_video_file_url' used in key specification without a key length' in  [error]
/vagrant/public/includes/database/database.inc:2204
Stack trace:
#0 /vagrant/public/includes/database/database.inc(2204): PDOStatement->execute(Array)
#1 /vagrant/public/includes/database/database.inc(683): DatabaseStatementBase->execute(Array, Array)
#2 /vagrant/public/includes/database/schema.inc(664): DatabaseConnection->query('CREATE TABLE {f...')
#3 /vagrant/public/includes/database/database.inc(2753): DatabaseSchema->createTable('field_data_fiel...', Array)
#4 /vagrant/public/modules/field/modules/field_sql_storage/field_sql_storage.module(269): db_create_table('field_data_fiel...', Array)
#5 [internal function]: field_sql_storage_field_storage_create_field(Array)
#6 /vagrant/public/includes/module.inc(926): call_user_func_array('field_sql_stora...', Array)
#7 /vagrant/public/modules/field/field.crud.inc(180): module_invoke('field_sql_stora...', 'field_storage_c...', Array)
#8 /vagrant/public/sites/all/modules/contrib/asset/modules/asset_video/asset_video.install(193): field_create_field(Array)
#9 [internal function]: asset_video_install()
#10 /vagrant/public/includes/module.inc(926): call_user_func_array('asset_video_ins...', Array)
#11 /vagrant/public/includes/module.inc(494): module_invoke('asset_video', 'install')
#12 /opt/drush/commands/core/drupal/environment_7.inc(143): module_enable(Array)
#13 /opt/drush/commands/pm/pm.drush.inc(1167): drush_module_enable(Array)
#14 [internal function]: drush_pm_enable('asset_video')
#15 /opt/drush/includes/command.inc(373): call_user_func_array('drush_pm_enable', Array)
#16 /opt/drush/includes/command.inc(224): _drush_invoke_hooks(Array, Array)
#17 [internal function]: drush_command('asset_video')
#18 /opt/drush/includes/command.inc(192): call_user_func_array('drush_command', Array)
#19 /opt/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#20 /opt/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#21 /opt/drush/drush.php(12): drush_main()
#22 {main}

The indices must be given a length in order to be added to a TEXT field. See http://dev.mysql.com/doc/refman/5.6/en/column-indexes.html for more information. Attached is a patch that adds a 255 character index which fits within the 767 byte index length limit.

IRuslan’s picture

Status: Needs review » Needs work
IRuslan’s picture

Status: Needs work » Needs review

  • IRuslan committed 4d25ee5 on 7.x-1.x
    Issue #2297897 by kiseleva.t, wwhurley, IRuslan, jchatard: Asset Video...
  • IRuslan committed 61eeeaa on 7.x-1.x authored by wwhurley
    Issue #2297897 by kiseleva.t, wwhurley, IRuslan, jchatard: Asset Video...
IRuslan’s picture

Status: Needs review » Fixed

@wwhurley
Thanks, very important fix.
I've also fixed the same problem within Emvideo sub-module.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.