?
avatar minhworks
minhworks
4 Aug 2016

Steps to reproduce the issue

Upgrading from 3.6.0 to 3.6.1 has caused SQL error to appear when visiting the menu items in the administrator area.

Our site is a simple Joomla site without any third party extensions. Our site is multilanguage and uses the association between menu items for the different language, which I think may be the cause of the issue.

By adding mt.title into the group by statement in administrator/components/com_menus/models/items.php line 256 seems to fix the issue.

Here is the error I get when visiting any menus category
url: administrator/index.php?option=com_menus&view=items&menutype=

Error
ERROR: column "mt.title" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: ...element AS componentname,ag.title AS access_level,"mt"."titl... ^SQL=SELECT "a"."id","a"."menutype","a"."title","a"."alias","a"."note","a"."path","a"."link","a"."type","a"."parent_id","a"."level","a"."published" AS "a.published","a"."component_id","a"."checked_out","a"."checked_out_time","a"."browserNav","a"."access","a"."img","a"."template_style_id","a"."params","a"."lft","a"."rgt","a"."home","a"."language","a"."client_id",CASE WHEN a.type = 'component' THEN a.published+2(e.enabled-1) WHEN a.type = 'url'AND a.published != -2 THEN a.published+2 WHEN a.type = 'url'AND a.published = -2 THEN a.published-1 WHEN a.type = 'alias'AND a.published != -2 THEN a.published+4 WHEN a.type = 'alias'AND a.published = -2 THEN a.published-1 WHEN a.type = 'separator'AND a.published != -2 THEN a.published+6 WHEN a.type = 'separator'AND a.published = -2 THEN a.published-1 WHEN a.type = 'heading'AND a.published != -2 THEN a.published+8 WHEN a.type = 'heading'AND a.published = -2 THEN a.published-1 END AS published ,l.title AS language_title, l.image AS language_image,u.name AS editor,c.element AS componentname,ag.title AS access_level,"mt"."title" AS "menutype_title",COUNT(asso2.id)>1 as association,e.name AS name FROM "#__menu" AS a LEFT JOIN "#__languages" AS l ON l.lang_code = a.language LEFT JOIN "#__users" AS u ON u.id = a.checked_out LEFT JOIN "#__extensions" AS c ON c.extension_id = a.component_id LEFT JOIN #__viewlevels AS ag ON ag.id = a.access LEFT JOIN "#__menu_types" AS "mt" ON "mt"."menutype" = "a"."menutype" LEFT JOIN #__associations AS asso ON asso.id = a.id AND asso.context='com_menus.item' LEFT JOIN #__associations AS asso2 ON asso2.key = asso.key LEFT JOIN #__extensions AS e ON e.extension_id = a.component_id WHERE a.id > 1 AND a.client_id = 0 AND (a.published IN (0, 1)) AND a.menutype IN('footer-en','mainmenu-en','news-en','top-menu-icon-en','footer-menu','mainmenu-fr','top-menu-icon-fr','mainmenu') GROUP BY a.id, e.enabled, l.title, l.image, u.name, c.element, ag.title, e.name ORDER BY a.lft asc LIMIT 20 ERROR: column "mt.title" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: ...element AS componentname,ag.title AS access_level,"mt"."titl... ^SQL=SELECT "a"."id","a"."menutype","a"."title","a"."alias","a"."note","a"."path","a"."link","a"."type","a"."parent_id","a"."level","a"."published" AS "a.published","a"."component_id","a"."checked_out","a"."checked_out_time","a"."browserNav","a"."access","a"."img","a"."template_style_id","a"."params","a"."lft","a"."rgt","a"."home","a"."language","a"."client_id",CASE WHEN a.type = 'component' THEN a.published+2(e.enabled-1) WHEN a.type = 'url'AND a.published != -2 THEN a.published+2 WHEN a.type = 'url'AND a.published = -2 THEN a.published-1 WHEN a.type = 'alias'AND a.published != -2 THEN a.published+4 WHEN a.type = 'alias'AND a.published = -2 THEN a.published-1 WHEN a.type = 'separator'AND a.published != -2 THEN a.published+6 WHEN a.type = 'separator'AND a.published = -2 THEN a.published-1 WHEN a.type = 'heading'AND a.published != -2 THEN a.published+8 WHEN a.type = 'heading'AND a.published = -2 THEN a.published-1 END AS published ,l.title AS language_title, l.image AS language_image,u.name AS editor,c.element AS componentname,ag.title AS access_level,"mt"."title" AS "menutype_title",COUNT(asso2.id)>1 as association,e.name AS name FROM "#__menu" AS a LEFT JOIN "#__languages" AS l ON l.lang_code = a.language LEFT JOIN "#__users" AS u ON u.id = a.checked_out LEFT JOIN "#__extensions" AS c ON c.extension_id = a.component_id LEFT JOIN #__viewlevels AS ag ON ag.id = a.access LEFT JOIN "#__menu_types" AS "mt" ON "mt"."menutype" = "a"."menutype" LEFT JOIN #__associations AS asso ON asso.id = a.id AND asso.context='com_menus.item' LEFT JOIN #__associations AS asso2 ON asso2.key = asso.key LEFT JOIN #__extensions AS e ON e.extension_id = a.component_id WHERE a.id > 1 AND a.client_id = 0 AND (a.published IN (0, 1)) AND a.menutype IN('footer-en','mainmenu-en','news-en','top-menu-icon-en','footer-menu','mainmenu-fr','top-menu-icon-fr','mainmenu') GROUP BY a.id, e.enabled, l.title, l.image, u.name, c.element, ag.title, e.name ORDER BY a.lft asc

Expected result

List of Menus

Actual result

SQL ERROR

System information (as much as possible)

Joomla version: 3.6.1
Apache: 2.4.6
PHP: 5.4.16
PostgreSQL: 9.2.15

Additional comments

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
5.00

avatar minhworks minhworks - open - 4 Aug 2016
avatar andrepereiradasilva
andrepereiradasilva - comment - 4 Aug 2016

please test #11446

avatar brianteeman
brianteeman - comment - 4 Aug 2016

Closed as we have a PR

avatar brianteeman brianteeman - change - 4 Aug 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-08-04 13:52:40
Closed_By brianteeman
avatar brianteeman brianteeman - close - 4 Aug 2016
avatar brianteeman brianteeman - change - 4 Aug 2016
Category Administration Administration Postgresql

Add a Comment

Login with GitHub to post a comment