Hi,

I have Drupal 7.17 installed. I installed View mode page 7.x-1.2 module using this url http://ftp.drupal.org/files/projects/view_mode_page-7.x-1.2.tar.gz.
There were no issues installing the module.
When I enable View Mode Page module. I get the following error.

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes: CREATE TABLE {view_mode_page} ( `content_type` VARCHAR(55) NOT NULL, `view_mode` VARCHAR(55) NOT NULL, `url_pattern` VARCHAR(255) NOT NULL, `show_title` INT DEFAULT 0, `title` VARCHAR(255) NOT NULL DEFAULT '', PRIMARY KEY (`content_type`, `view_mode`, `url_pattern`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8; Array ( ) in db_create_table() (line 2688 of /data/21/2/26/19/2026834/user/2218471/htdocs/drupal7/includes/database/database.inc).

Comments

rballou’s picture

Thanks for sending this in. Are you using MySQL for your database?

rballou’s picture

Status: Active » Postponed (maintainer needs more info)

I just did a test with MySQL, Drupal 7.18, and the link provided above and did not get an error. So if you have more information about the issue that could help me track it down. Thanks!

baziz’s picture

yes I am using MySQL server.

baziz’s picture

Hi,

No, I have not upgraded my Drupal 7 website to Drupal 7.18.
I am still at version 7.17.

Thanks,
baziz

David Blas Bray’s picture

I have made a fresh install of Drupal 7.19 (the platform type of the server is Debian) and the first module I have installed is View Mode Page. When I try to enable the module I get the following error:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes: CREATE TABLE {view_mode_page} ( content_type VARCHAR(55) NOT NULL, view_mode VARCHAR(55) NOT NULL, url_pattern VARCHAR(255) NOT NULL, show_title INT DEFAULT 0, title VARCHAR(255) NOT NULL DEFAULT '', PRIMARY KEY (content_type, view_mode, url_pattern) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8; Array ( ) in db_create_table() (line 2688 of /hermes/waloraweb021/b1678/moo.blasbray/mimooc.com/includes/database/database.in‌​c).

The reason why I made a fresh install of Drupal is because before doing the fresh install I had the following problem:

I am trying to activate the View Mode Page module because I need to use URLs to jump from one view mode to another. From teaser to presentation to full node. Every time I try to activate the View Mode Page it gives me an error and after that I am unable to view the Manage Display section for any of my content types.

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drp_obdcbn7hei.view_mode_page' doesn't exist: SELECT view_mode_page.* FROM {view_mode_page} view_mode_page WHERE (content_type = :db_condition_placeholder_0) AND (view_mode = :db_condition_placeholder_1) ; Array ( [:db_condition_placeholder_0] => tu_mooc [:db_condition_placeholder_1] => default )

rballou’s picture

Status: Postponed (maintainer needs more info) » Needs review

I have pushed a couples change to the development version which may help. The issue seems to be large byte size character sets (like UTF8) that bump the index size over 1000 bytes. So I have changed the URL pattern column size down to 200. Hopefully that is still sufficient! Give it a shot and let me know if that works.

rballou’s picture

Category: support » bug

Changing category

David Blas Bray’s picture

I have deleted the recommended View Mode Page release and installed the development release. When I try to enable the module I get this:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes: CREATE TABLE {view_mode_page} ( `content_type` VARCHAR(55) NOT NULL, `view_mode` VARCHAR(55) NOT NULL, `url_pattern` VARCHAR(255) NOT NULL, `show_title` INT DEFAULT 0, `title` VARCHAR(255) NOT NULL DEFAULT '', PRIMARY KEY (`content_type`, `view_mode`, `url_pattern`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8; Array ( ) in db_create_table() (line 2688 of /hermes/waloraweb021/b1678/moo.blasbray/mimooc.com/includes/database/database.inc).

Thanks for your help.

rballou’s picture

You may have to get the version from git until drupal.org builds the nightly development version. Sorry I forgot to mention that. It should have url_pattern set to a length of 200 instead of 255.

David Blas Bray’s picture

I have been using drupal for a few weeks so I don't quite know what to do with git. When will the nightly development version be ready (more or less)?

rballou’s picture

Usually the next day. Git is also pretty simple. You can see the instructions for Git on the project page. Essentially you can checkout the dev version (7.x-1.x) and place that in your sites/all/modules/* (or however you are installing modules for your project).

David Blas Bray’s picture

Version: 7.x-1.2 » 7.x-1.x-dev

I have installed the development version just now and enabled the module without any errors. Thank you for your help.

rballou’s picture

Status: Needs review » Fixed

A new release, 7.x-1.3, will be available soon. Thanks everyone for helping track this down.

Status: Fixed » Closed (fixed)

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