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

Intermittent error from the quiz reports on MySQL because of subtracting two unsigned columns

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.3
    • Component/s: Quiz
    • Labels:
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      I tested with the following test steps:

      • Connect as admin.
      • Create two essay questions
      • Create a quizz
      • Edit quizz (Navigation: quizz administration) and add two random question (with the two previous essay questions). The quizz should have two page with a random question of each page.
      • Connect as student and answer quizz.
      • As admin I tried to view the attempt (/Moodle_Integration/mod/quiz/report.php?id=5&mode=overview)
        Just after the following text "Showing graded and ungraded attempts for each user. The one attempt for each user that is graded is highlighted. The grading method for this quiz is Highest grade.", I can see this exception:

      Error reading from database
       
      More information about this error
       
      Debug info: BIGINT UNSIGNED value is out of range in '(`moodle_registration`.`qa`.`timefinish` - `moodle_registration`.`qa`.`timestart`)'
      SELECT CONCAT(u.id, '#', COALESCE(qa.attempt, 0)) AS uniqueid, (CASE WHEN qa.sumgrades = (SELECT MAX(qa2.sumgrades) FROM mdl_quiz_attempts qa2 WHERE qa2.quiz = qa.quiz AND qa2.userid = qa.userid) AND qa.timestart = (SELECT MIN(qa3.timestart) FROM mdl_quiz_attempts qa3 WHERE qa3.quiz = qa.quiz AND qa3.userid = qa.userid AND qa3.sumgrades = qa.sumgrades) THEN 1 ELSE 0 END) AS gradedattempt, qa.uniqueid AS attemptuniqueid, qa.id AS attempt, u.id AS userid, u.idnumber, u.firstname, u.lastname, u.picture, u.imagealt, u.email, qa.sumgrades, qa.timefinish, qa.timestart, qa.timefinish - qa.timestart AS duration , COALESCE((SELECT MAX(qqr.regraded) FROM mdl_quiz_question_regrade qqr WHERE qqr.attemptid = qa.uniqueid),-1) AS regraded FROM mdl_user u LEFT JOIN mdl_quiz_attempts qa ON qa.userid = u.id AND qa.quiz = ? WHERE qa.id IS NOT NULL AND qa.preview = 0 ORDER BY uniqueid ASC LIMIT 0, 30
      [array (
      0 => '1',
      )]
      Stack trace:
      line 391 of /lib/dml/moodle_database.php: dml_read_exception thrown
      line 790 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 1354 of /lib/tablelib.php: call to mysqli_native_moodle_database->get_records_sql()
      line 323 of /mod/quiz/report/overview/overview_table.php: call to table_sql->query_db()
      line 1375 of /lib/tablelib.php: call to quiz_report_overview_table->query_db()
      line 391 of /mod/quiz/report/overview/report.php: call to table_sql->out()
      line 90 of /mod/quiz/report.php: call to quiz_overview_report->display()

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              timhunt Tim Hunt
              Reporter:
              jerome Jérôme Mouneyrac
              Tester:
              Eloy Lafuente (stronk7)
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                5/May/11