CMS MADE SIMPLE FORGE

Uploads

 

[#12016] SQL error in MySQL 5.7 in summary view with ONLY_FULL_GROUP_BY directive

avatar
Created By: Mathieu Muths (airelibre) (airelibre)
Date Submitted: Thu Apr 04 04:29:13 -0400 2019

Assigned To: Robert Campbell (calguy1000)
Version: None
CMSMS Version: 2.2.8
Severity: Critical
Resolution: None
State: Open
Summary:
SQL error in MySQL 5.7 in summary view with ONLY_FULL_GROUP_BY directive
Detailed Description:
Hello,

the frrontend files summary query fails in action.default.php on a PHP7.2 with
MySQL 5.7 and ONLY_FULL_GROUP_BY directive active in the SQL MODE

The query launched line 341:
SELECT SQL_CALC_FOUND_ROWS U.*,C.upload_category_deletable,D.num AS downloads 
FROM cms_module_uploads U 
LEFT JOIN cms_module_uploads_categories C ON U.upload_category_id =
C.upload_category_id
LEFT JOIN (SELECT count(download_id) AS num,file_id FROM
cms_module_uploads_downloads GROUP BY file_id) AS D ON U.upload_id = D.file_id
WHERE U.upload_category_id IN (1) 
GROUP BY U.upload_id
ORDER BY upload_date ASC 
LIMIT 0, 1000

The error:
#1055 - Expression #13 of SELECT list is not in GROUP BY clause and contains
nonaggregated column 'mydb.C.upload_category_deletable' which is not
functionally dependent on columns in GROUP BY clause; this is incompatible with
sql_mode=only_full_group_by

Just tried with :
GROUP BY U.upload_id, C.upload_category_deletable, D.num

And seems to work better, but this needs some digging into it

Couldn't revert the only_full_group_by stuff because hose doesn't allow to
change it

Thanks for your attention,


History