Loading...
 
Skip to main content

mysql5.7: ttif.value which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Status
Closed
Subject
mysql5.7: ttif.value which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Version
12.x
12.x Regression
15.x
15.x Regression
Category
  • Error
  • Regression
Feature
Installer (profiles, upgrades and server-related issues)
Resolution status
Out of Date
Submitted by
Xavi (as xavidp - admin)
Lastmod by
Xavier de Pedro
Rating
(0)
Description

Applying the profile "Tracker_as_calendar_12" with php 5.6 or php7.0 (on ubuntu 16.04 64 bits with mysql 5.7) produces this type of error:

Copy to clipboard
System error. The following error message was returned: Expression #8 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'tiki12svn_trackercalendar.ttif.value' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by The query was: SELECT tti.*, ttif.`value`, ttf.`type`, `lastModif` as `sortvalue` FROM ( `tiki_tracker_items` tti INNER JOIN `tiki_tracker_item_fields` ttif ON tti.`itemId` = ttif.`itemId` INNER JOIN `tiki_tracker_fields` ttf ON ttf.`fieldId` = ttif.`fieldId`) WHERE tti.`trackerId` = ? and (`status`=? or `status`=?) AND `ttif`.`fieldId` IN( ?,?,?,?,?,? ) GROUP BY tti.`itemId` ORDER BY `sortvalue` desc Values: 1 o p 1 2 3 4 5 6 The built query was likely: SELECT tti.*, ttif.`value`, ttf.`type`, `lastModif` as `sortvalue` FROM ( `tiki_tracker_items` tti INNER JOIN `tiki_tracker_item_fields` ttif ON tti.`itemId` = ttif.`itemId` INNER JOIN `tiki_tracker_fields` ttf ON ttf.`fieldId` = ttif.`fieldId`) WHERE tti.`trackerId` = '1' and (`status`='o' or `status`='p') AND `ttif`.`fieldId` IN( '1','2','3','4','5','6' ) GROUP BY tti.`itemId` ORDER BY `sortvalue` desc Stacktrace: * /var/www/html/12.x/tiki-index.php : 0 -> {main}(array ( )) * /var/www/html/12.x/tiki-index.php : 686 -> __toString(array ( )) * /var/www/html/12.x/lib/core/Tiki/Render/Lazy.php : 22 -> call_user_func:{/var/www/html/12.x/lib/core/Tiki/Render/Lazy.php:22}(array ( )) * /var/www/html/12.x/lib/core/Tiki/Render/Lazy.php : 22 -> {closure:/var/www/html/12.x/lib/wiki/renderlib.php:331-341}(array ( )) * /var/www/html/12.x/lib/wiki/renderlib.php : 334 -> get_parse(array ( )) * /var/www/html/12.x/lib/wiki/wikilib.php : 488 -> parse_data(array ( )) * /var/www/html/12.x/lib/tikilib.php : 386 -> parse_data(array ( )) * /var/www/html/12.x/lib/parser/parserlib.php : 1589 -> parse_first(array ( )) * /var/www/html/12.x/lib/parser/parserlib.php : 476 -> plugin_execute(array ( )) * /var/www/html/12.x/lib/parser/parserlib.php : 1018 -> wikiplugin_tabs(array ( )) * /var/www/html/12.x/lib/wiki-plugins/wikiplugin_tabs.php : 84 -> parse_data(array ( )) * /var/www/html/12.x/lib/tikilib.php : 386 -> parse_data(array ( )) * /var/www/html/12.x/lib/parser/parserlib.php : 1589 -> parse_first(array ( )) * /var/www/html/12.x/lib/parser/parserlib.php : 476 -> plugin_execute(array ( )) * /var/www/html/12.x/lib/parser/parserlib.php : 1018 -> wikiplugin_trackerlist(array ( )) * /var/www/html/12.x/lib/wiki-plugins/wikiplugin_trackerlist.php : 1692 -> list_items(array ( )) * /var/www/html/12.x/lib/trackers/trackerlib.php : 1274 -> fetchAll(array ( )) * /var/www/html/12.x/lib/core/TikiDb/Bridge.php : 32 -> fetchAll(array ( )) * /var/www/html/12.x/lib/core/TikiDb/Pdo.php : 109 -> handleQueryError(array ( )) * /var/www/html/12.x/lib/core/TikiDb.php : 148 -> handle(array ( ))


Same profile applied on older mysql (5.6) and older svn revision works as expected. Reproduced here:
https://demo.tiki.org/12x/tiki-index.php?page=Tracker_as_Calendar_12
u: admin
p: 12345

Solution

fixed in r61023. Applied cheapest fix with ANY_VALUE to the offending columns in the SELECT command, as suggested in https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html. Not a backport since this error is not present in current 15.x or 16.x.


UPDATE: I reverted r61023 in r61164
FIXReverting r61023. Revert My fix of ANY_VALUE function as a workaround for ONLY_FULL_GROUP_BY mode and compatibility with MySQL 5.7, because it is not compatible with MariaDB 10.0.x (function ANY_VALUE() doesn't exist) which can be also the default db engine in some servers. Related: https://jira.mariadb.org/browse/MDEV-10426 .

Workaround

Alternative workaround those using Mysql 5.7:

Copy to clipboard
mysql > SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
Importance
5
Easy to solve?
4
Priority
20
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
5923
Created
Thursday 05 May, 2016 11:23:44 UTC
by Xavi (as xavidp - admin)
LastModif
Saturday 07 March, 2020 08:53:39 UTC


Show PHP error messages