Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.9
-
Fix Version/s: 1.9.1
-
Component/s: Database activity module
-
Labels:None
-
Environment:1.9 moodle with a 8.2.4 postgres installed in a SUSE Linux Enterprise Server 10 SP1
-
Database:PostgreSQL
-
Affected Branches:MOODLE_19_STABLE
-
Fixed Branches:MOODLE_19_STABLE
Description
In advanced search form, the single and multiple menu fields not display correct because an SQL query error.
The error display:
ERROR: column "mdl_data_content.id" must appear in the GROUP BY clause or be used in an aggregate function
SELECT id, content from mdl_data_content WHERE fieldid=4 GROUP BY content ORDER BY content
There are two php files affected:
1) mod/data/field/menu/field.class.php
Error line 62:
$temp = get_records_sql_menu('SELECT id, content from '.$CFG->prefix.'data_content WHERE fieldid='.$this->field->id.' GROUP BY content ORDER BY content');
Solution: (add id in GROUP BY)
$temp = get_records_sql_menu('SELECT id, content from '.$CFG->prefix.'data_content WHERE fieldid='.$this->field->id.' GROUP BY id,content ORDER BY content');
2) mod/data/field/multimenu/field.class.php
Error line 66:
$temp = get_records_sql_menu('SELECT id, content from '.$CFG->prefix.'data_content WHERE fieldid='.$this->field->id.' GROUP BY content ORDER BY content');
Solution: (add id in GROUP BY)
$temp = get_records_sql_menu('SELECT id, content from '.$CFG->prefix.'data_content WHERE fieldid='.$this->field->id.' GROUP BY id,content ORDER BY content');
should be fixed now, thanks for the report