Tuesday, August 6, 2013

A Tale of Two Maxes

A few days ago an odd error message experienced by a SugarCRM user made its way to my desk. After scratching my head for a few minutes, some ideas for its source came to mind and the problem was corrected. 

Soon thereafter, a similar scenario once again made its way to me, but the conditions causing the error seemed a bit different. Fortunately, both scenarios resulted in similar errors and the solution for the prior scenario was equally applicable to the latter.

This is the error, extracted from the sugarcrm.log file:

MySQL error 1439: Display width out of range for column '<some_field_name>' (max = 255)

So what is this error telling us? The error is telling us that the referenced field cannot be created because its definition indicates a desired width larger than 255. In this particular case, it was an integer field, which in turn translates to a field that can hold more than 255 digits. Note that this a reference to the number of individual digits the field can hold, or its width, not the maximum value it can hold. This brings us to the crux of the problem.