tmccormi wrote on Friday, December 04, 2015:
I’ve run into this quite a few times…
When doing a upgrade to a system where users have added extra fields to the patient_data via LBF the upgrade fails with an error like what follows:
ERROR: query failed: ALTER TABLE patient_data
ADD COLUMN email_direct
varchar(255) NOT NULL default ‘’
Error: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
The solution above works or you can just reduce the size of several of the fields that are set to VARCHAR(255) for no good (ie: legacy) reasons. like …
title
varchar(255) NOT NULL default ‘’,
language
varchar(255) NOT NULL default ‘’,
financial
varchar(255) NOT NULL default ‘’,
fname
varchar(255) NOT NULL default ‘’,
lname
varchar(255) NOT NULL default ‘’,
mname
varchar(255) NOT NULL default ‘’,
DOB
date default NULL,
street
varchar(255) NOT NULL default ‘’,
… and on and on
The database.sql file should be updated for new installs to use reasonable length VARCHARS. no reason for the names and postal codes to be 255, they should reflect the actual needed size. I don’t think this needs to be in upgrades as well, but it could be with some care.
and on that note. We should never be using VARCHAR for text fields that, from the UI, look like unlimited notes boxes, those should the type TEXT. More than 255 characters typed in a field set with VARCHAR(255) are silently truncated if the box itself has not had the max-length set, very bad for medical records.
Just some thoughts …