-
Bug
-
Resolution: Fixed
-
Major
-
2.7.2, 2.8.3
-
Debian.
-
Microsoft SQL
-
MOODLE_27_STABLE, MOODLE_28_STABLE
-
MOODLE_27_STABLE, MOODLE_28_STABLE
-
MDL-49216-master -
- Run unit test 'test_count_discussion_replies' on all DB servers.
-
Team Beards Sprint 3
I'm getting the following DB read error message when trying to view all posts in a Standard forum displayed in a blog-like format:
Debug info: The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.
SELECT TOP 100 * FROM (SELECT p.discussion, (COUNT(p.id) - 1) AS replies, MAX(p.id) AS lastpostid
FROM mdl_forum_posts p
JOIN mdl_forum_discussions d ON p.discussion = d.id
WHERE d.forum = ?
GROUP BY p.discussion , d.timemodified
ORDER BY d.timemodified DESC) sq
[array (
0 => '13027',
)]
Error code: dmlreadexception
Stack trace:
line 443 of /lib/dml/moodle_database.php: dml_read_exception thrown
line 242 of /lib/dml/mssql_native_moodle_database.php: call to moodle_database->query_end()
line 724 of /lib/dml/mssql_native_moodle_database.php: call to mssql_native_moodle_database->query_end()
line 758 of /lib/dml/mssql_native_moodle_database.php: call to mssql_native_moodle_database->get_recordset_sql()
line 2482 of /mod/forum/lib.php: call to mssql_native_moodle_database->get_records_sql()
line 5683 of /mod/forum/lib.php: call to forum_count_discussion_replies()
line 223 of /mod/forum/view.php: call to forum_print_latest_discussions()
This has only happened recently, so I'm a little puzzled as to the cause.