Upgrading from 3.1.2.1 to 3.3.0.4 database problem with 1406 Data too long

I am upgrading OJS from 3.1.2.1 to 3.3.0.4 using the web interface and I am getting the error below:-

A database error has occurred: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column ‘label’ at row 29 (SQL: ALTER TABLE issue_galleys MODIFY COLUMN label VARCHAR(32))

Has anyone got an idea how I can fix this?

Thanks
Nason

I figured out the issue. In the 3.1.x database the column with name of label in issue-galleys table is declared as a VARCHAR(255) while in 3.2.x database it is VARCHAR(32). Coincidently I have entries which were more than 32 characters in length hence the error.

Solution
On the 3.1.x database, I corrected the entries by: -
Identified the the offending entries by running
SELECT galley_id, label, CHAR_LENGTH(label) AS labelLength FROM issue_galleys WHERE CHAR_LENGTH(label) > 32;

For each offending entry I truncated the value via an update
UPDATE issue_galleys SET label = ‘{my truncated value}’ WHERE galley_id = {galley_id_value};

Cheers
Nason

1 Like