Guide for fixing the Mysql2 "Data too long for column" error

If you have an error that shows in the logs (production.log file or the server error log file) message as the below mentioned, then please follow this guide to fix it on your plugin.

Error message:

Mysql2::Error: Data too long for column

A more detailed error message example could be checked here:

ActiveRecord::ValueTooLong (Mysql2::Error: Data too long for column 'value' at row 1: UPDATE `settings` SET `value` = '---\nname_format: firstname_lastname\npost_address_format: \"%street1%\\r\\n%street2%\\r\\n%city%, postcode\\r\\n%region%\\r\\n%country%\"\ndefault_country: ES\ncontacts_show_in_app_menu: \'1\'\ndisable_taxes: \'1\'\ndefault_tax: \'0.0\'\ntax_type: \'1\'\ndefault_currency: EUR\nmajor_currencies: USD, EUR, GBP,

Note: Please keep in mind that the detailed logs message is taken from the Helpdesk plugin but the error, in general, could appear to any of the RedmineUP plugins.

To solve this problem, you need to increase the size of the field which stores Redmine setting values. So, it is necessary to open the DB console and run the following commands.

  • for Mysql:
ALTER TABLE settings MODIFY COLUMN value LONGTEXT;
  • for Postgresql:
ALTER TABLE settings ALTER COLUMN value TYPE text;
Was this article helpful? Yes  No
702 from 747 found this helpful