Skip to content

Commit

Permalink
Fix creation performance of form element menuparent, (slow down in me…
Browse files Browse the repository at this point in the history
…nu 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()`
  • Loading branch information
ggppdk authored and rdeutz committed Aug 25, 2016
1 parent fc7c7ba commit 99a76db
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 99a76db

Please sign in to comment.