Temp table column too short in legacycustomsearches
I got a "DB Error: unknown error" in "Rebuild Smart Group Cache" in the Scheduled Jobs. In the Log file it says "[nativecode=1406 ** Data too long for column 'group_names' at row 1]"
Which started "civicrm/ext/legacycustomsearches/CRM/Contact/Form/Search/Custom/Group.php(435)"
What happens there just above is:
$this->_iGTable->createWithColumns("id int PRIMARY KEY AUTO_INCREMENT, contact_id int, group_names varchar(64)");
if ($iGroups) {
$includeGroup = "INSERT INTO {$this->_iGTableName} (contact_id, group_names)
SELECT civicrm_contact.id as contact_id, civicrm_group.title as group_name
FROM civicrm_contact
INNER JOIN civicrm_group_contact
ON civicrm_group_contact.contact_id = civicrm_contact.id
LEFT JOIN civicrm_group
ON civicrm_group_contact.group_id = civicrm_group.id";
}
The issue is that civicrm_group.title is varchar(255) while group_names in this temp table is varchar(64). We had one group title which was 77 chars. When I shortened it, it worked again.
So make it "group_names varchar(255)" and it should work (or use civicrm_group.name in the select, but I suspect a reason why that was not used here)