== Problem ==
The SQL query in line line 162 of mod/survey/lib.php is incorrect. Here is the error message that the database gives along with a traceback:
Column 'mdl_survey_answers.time' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
SELECT sa.userid, sa.survey, sa.time, u.firstname, u.lastname, u.email, u.picture FROM mdl_survey_answers sa JOIN mdl_user u ON u.id = sa.userid WHERE sa.survey IN (14,15,16) AND sa.time > 1209578400 GROUP BY sa.userid, sa.survey ORDER BY sa.id ASC
- line 686 of lib/dmllib.php: call to debugging()
- line 162 of mod/survey/lib.php: call to get_recordset_sql()
- line 942 of course/lib.php: call to survey_print_recent_activity()
- line 27 of blocks/recent_activity/block_recent_activity.php: call to print_recent_activity()
- line 317 of blocks/moodleblock.class.php: call to block_recent_activity->get_content()
- line 341 of blocks/moodleblock.class.php: call to block_base->is_empty()
- line 338 of lib/blocklib.php: call to block_base->_print_block()
- line 369 of course/format/twu/format.php: call to blocks_print_group()
- line 226 of course/view.php: call to require()
== Solution ==
Adding the extra columns to the GROUP BY clause will remove the error message (although I'm not certain that the code is doing what it was meant to do).
To do this, change line 161 to:
"GROUP BY sa.userid, sa.survey, sa.time, u.firstname, u.lastname, u.email, u.picture, sa.id"
- duplicates
-
MDL-14583 PostgreSQL error in survey + recent activity block
-
- Closed
-