Page MenuHomePhabricator

[AJAXPoll] sql/create-table--ajaxpoll_vote.sql : Error: 1071 Specified key was too long; max key length is 767 bytes
Open, Needs TriagePublic

Description

When running MySQL/MariaDB with charset utf8mb4, a character is 4 bytes. Hence a key created on a VARCHAR(255) takes 255 characters * 4 bytes/characters = 1020 bytes. However Innodb defaults to a maximum of 767 bytes for an index.

The extension fails to install on Debian Stretch which uses utf8mb4 as the default charset:

Query: CREATE TABLE IF NOT EXISTS `ajaxpoll_vote` (
 `poll_id` varchar(32) NOT NULL default '',
 `poll_user` varchar(255) NOT NULL default '',
 `poll_ip` varchar(255) default NULL,
 `poll_answer` int(3) default NULL,
 `poll_date` datetime default NULL,
 PRIMARY KEY  (`poll_id`,`poll_user`)
 ) ENGINE=InnoDB

Function: Wikimedia\Rdbms\Database::sourceFile( /workspace/src/extensions/AJAXPoll/includes/../sql/create-table--ajaxpoll_vote.sql )
Error: 1071 Specified key was too long; max key length is 767 bytes (localhost:/tmp/quibble-mysql-hkzoeqmk/socket)

Event Timeline

hashar created this task.May 1 2018, 7:09 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 1 2018, 7:09 PM
Vvjjkkii renamed this task from [AJAXPoll] sql/create-table--ajaxpoll_vote.sql : Error: 1071 Specified key was too long; max key length is 767 bytes to gvdaaaaaaa.Jul 1 2018, 1:12 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
Mainframe98 renamed this task from gvdaaaaaaa to [AJAXPoll] sql/create-table--ajaxpoll_vote.sql : Error: 1071 Specified key was too long; max key length is 767 bytes .Jul 1 2018, 10:52 AM
Mainframe98 raised the priority of this task from High to Needs Triage.
Mainframe98 updated the task description. (Show Details)
Mainframe98 added a subscriber: Aklapper.