Section error when dragging column order

7 posts by 2 authors in: Forums > CMS Builder
Last Post: March 27, 2018   (RSS)

By kitsguru - January 4, 2018

I am receiving the following in one section when I try to change the column order

Error: MySQL Error: Specified key was too long; max key length is 1000 bytes
 - in editTable_functions.php on line 381 by _saveFieldOrder_updateColumnOrder()

Schema attached

Jeff Shields
Attachments:

custom_pages.ini.php 16K

By Dave - January 5, 2018

Hi Jeff, 

Ok, glad you got it working.  If that comes up again or you'd like us to investigate it further just let me know.

Cheers!

Dave Edis - Senior Developer
interactivetools.com

By kitsguru - January 5, 2018

I think you will find this error coming up more frequently now that the database matches the ini column order.

There might be two solutions.

Change the table engine to innodb

OR

split the alter table command so its total length is less than 1000 characters.

Jeff Shields

By Dave - January 5, 2018

I think it's related to the key length of the columns, or maybe any indexes used on the table. I don't think it's related to the length of the query itself.  We recently changed the default charset from utf8 to utfmb4 which supports more characters such as emojis and other languages.  CMSB should automatically update your database to resolve that issue.  If you run into it again on another server feel free to email me details to dave@interactivetools.com and I can debug it. (Don't post login details to the forum).

There's probably no harm in changing the table type but I wouldn't suggest it as a default because it's not addressing the underlying issue.

Cheers!

Dave Edis - Senior Developer
interactivetools.com

By kitsguru - January 5, 2018 - edited: January 6, 2018

[edited]

The max key length for myisam is 1000. The InnoDB internal maximum key length is 3500 bytes, but MySQL itself restricts this to 3072 bytes.

Since innodb is now the default and is better for overall performance with record locking instead of table locking, it might be worth moving in that direction.

See: https://www.mysql.com/why-mysql/presentations/myisam-2-innodb-why-and-how/

Also see: https://www.percona.com/blog/2016/10/11/mysql-8-0-end-myisam/

Jeff Shields

By kitsguru - March 27, 2018

To change a table to INNODB :

Alter Table cmsb_accounts ENGINE=INNODB;

Jeff Shields