From 99a76db902b8f1315a00e99a6b1d6551154aa26a Mon Sep 17 00:00:00 2001 From: Georgios Papadakis Date: Thu, 25 Aug 2016 23:21:46 +0300 Subject: [PATCH] Fix creation performance of form element menuparent, (slow down in menu item edit form, for item that belongs to large menu) (#11628) * Remove unused left join in getOptions for menuparent form element * Replaced unneeded group by with distinct * fix #11628 for postgresql (#2) in postgresql don't work as it is now , it give an **SQL ERROR** for the `ORDER BY` clause field used `a.lft` must be in the select list of fields when the `SELECT` use `DISTINCT()` --- .../components/com_menus/models/fields/menuparent.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/administrator/components/com_menus/models/fields/menuparent.php b/administrator/components/com_menus/models/fields/menuparent.php index 13a94eefce7f1..cb665c34e41f6 100644 --- a/administrator/components/com_menus/models/fields/menuparent.php +++ b/administrator/components/com_menus/models/fields/menuparent.php @@ -39,9 +39,8 @@ protected function getOptions() $db = JFactory::getDbo(); $query = $db->getQuery(true) - ->select('a.id AS value, a.title AS text, a.level') - ->from('#__menu AS a') - ->join('LEFT', $db->quoteName('#__menu') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt'); + ->select('DISTINCT(a.id) AS value, a.title AS text, a.level, a.lft') + ->from('#__menu AS a'); // Filter by menu type. if ($menuType = $this->form->getValue('menutype')) @@ -69,7 +68,6 @@ protected function getOptions() } $query->where('a.published != -2') - ->group('a.id, a.title, a.level, a.lft, a.rgt, a.menutype, a.parent_id, a.published') ->order('a.lft ASC'); // Get the options.