netgen / NetgenInformationCollectionBundle

Information collection alike feature for eZ Publish 5/eZ Platform
https://netgen.io
GNU General Public License v2.0
19 stars 8 forks source link

Infocollection admin interface is incompatible with MySQL 5.7+ #34

Closed darinda closed 5 years ago

darinda commented 5 years ago

When trying to access the infocollection admin interface on a server with MySQL 5.7+ installed there will be a fatal error:

An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT eco.id AS content_id, eco.name, ecot.main_node_id, ecc.serialized_name_list, ecc.identifier AS class_identifier FROMezcontentobjecteco LEFT JOINezcontentobject_treeecot ONeco.id=ecot.contentobject_idINNER JOINezcontentclassecc ONeco.contentclass_id=ecc.idWHERE (ecc.version = 0) AND (eco.id IN (637, 1414, 1563)) GROUP BYecot.main_node_idLIMIT 10'

This is caused by MySQL's only_full_group_by mode being turned on as explained in this issue on Stackoverflow.

It can be fixed by aggregating the selected columns in the corresponding controller instead of only selecting the values which would produce unpredictable results.

Using the max aggregation function on all selected fields should be ok in this case because the column's values will always be the same for all rows matched by the group by clause.

MarioBlazek commented 5 years ago

Fixed, thanks for reporting @darinda.