Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-49216

DB error when getting count of replies on MSSQL

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 2.7.6, 2.8.4
    • 2.7.2, 2.8.3
    • Forum
    • Debian.
    • 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.

            dobedobedoh Andrew Lyons
            martyjacobs Marty
            Ankit Agarwal Ankit Agarwal
            Dan Poltawski Dan Poltawski
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.