Hi,

I'm unable to install this module with MariaDB 5.5.56 and a character set of utf8mb4. Here's the error I'm receiving:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 1709 Index column size
too large. The maximum column size is 767 bytes.: CREATE TABLE {nodeaccess} (
`nid` INT unsigned NOT NULL DEFAULT 0,
`gid` INT unsigned NOT NULL DEFAULT 0,
`realm` VARCHAR(255) NOT NULL DEFAULT '',
`grant_view` TINYINT unsigned NOT NULL DEFAULT 0,
`grant_update` TINYINT unsigned NOT NULL DEFAULT 0,
`grant_delete` TINYINT unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`nid`, `gid`, `realm`)
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4;

Upon further investigation I found this page: http://mysql.rjweb.org/doc.php/index_cookbook_mysql#limitations

In 5.6 / 10.0, you may not include a column that equates to bigger than 767 bytes: VARCHAR(255) CHARACTER SET utf8 or VARCHAR(191) CHARACTER SET utf8mb4

I can confirm that changing the column length to 191 works.

CommentFileSizeAuthor
#2 2945214-2.patch359 bytesnathandentzau

Comments

nathandentzau created an issue. See original summary.

nathandentzau’s picture

StatusFileSize
new359 bytes

A quick glance at the module's codebase I don't see in anyway where a realm could even be close to 191 characters. So here's my patch.

nathandentzau’s picture

Status: Active » Needs review
nathandentzau’s picture

Title: Unable to install module with with MariaDB 5.5 with a character set of utf8mb4 » Unable to install module with MySQL/MariaDB character set of utf8mb4
gceja’s picture

We have a similar error when trying to install Nodeaccess 8.x-1.0-beta1:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes: CREATE TABLE {nodeaccess} ( `nid` INT unsigned NOT NULL DEFAULT 0, `gid` INT unsigned NOT NULL DEFAULT 0, `realm` VARCHAR(255) NOT NULL DEFAULT '', `grant_view` TINYINT unsigned NOT NULL DEFAULT 0, `grant_update` TINYINT unsigned NOT NULL DEFAULT 0, `grant_delete` TINYINT unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`nid`, `gid`, `realm`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4; Array ( ) in drupal_install_schema()

Using:
Drupal core 8.4.5
MariaDB

Will this patch fix all these issues? @nathandentzau

Thank you.

oakulm’s picture

Status: Needs review » Reviewed & tested by the community

Yes this patch seems to fix the problem

  • mukila committed fb8ce53 on 8.x-1.x
    Issue #2945214 by nathandentzau: Unable to install module with MySQL/...
mukila’s picture

Status: Reviewed & tested by the community » Fixed

Applied patch in 8.x-1.0-beta2 release

Status: Fixed » Closed (fixed)

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