MySQL 5.7.5+ support for get_tag_cloud_tags()
Having a Tag Cloud widget on the dashboard when used with MySQL 5.7.5+ (released Sept 2014) results in the following message being displayed:
Syntax Error: SELECT tag,tag_id,COUNT(object_id) AS quantity FROM vtiger_freetags INNER JOIN vtiger_freetagged_objects ON (vtiger_freetags.id = tag_id) WHERE 1=1 AND tagger_id = ? GROUP BY tag ORDER BY quantity DESC LIMIT 0, 100
This is because as of MySQL 5.7.5 ONLY_FULL_GROUP_BY is enabled by default.
Easiest way to solve this seemed to be to add tag_id
to the GROUP BY statement thus:
libraries/freetag/freetag.class.php
function get_tag_cloud_tags($max = 100, $tagger_id = NULL,$module = "",$obj_id = NULL) {
...
- GROUP BY tag
+ GROUP BY tag,tag_id
...
}
It's also worth noting that the freetag library (https://github.com/freetag/freetag) doesn't bother SELECTing tag_id
at all, so an alternative solution would be to just remove it, but I didn't look into the code enough to check if this would have any adverse effects or not.
However here is a patch for the original suggestion: vtiger-get_tag_cloud_tags-tag_id.patch