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

Error reading from database - Unknown column 'status' in 'order clause'

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.9.14, 2.0.5, 2.1.2, 2.2
    • Fix Version/s: 1.9.15, 2.0.6, 2.1.3
    • Component/s: Assignment (2.2)
    • Labels:
    • Environment:
      Moodle 2.1.1+, build 20110916, upgraded from 2.1.
      Debian GNU/Linux 6.0.2 (squeeze); Apache/2.2.16 (Debian); PHP 5.3.3-7+squeeze3 with Suhosin-Patch; mysql Ver 14.14 Distrib 5.1.49.
    • Database:
      MySQL
    • Testing Instructions:
      Hide

      1 Click on an Assignment activity with submitted assignments.
      2 Click on the "View n submitted assignments" link. A summary table appears.
      3 Click on the 'Status' column header, to sort the table by status.
      4 Verify that the column sorts by status.
      5 Click on any entry in the status column.
      6 Verify that the page loads without error.

      Show
      1 Click on an Assignment activity with submitted assignments. 2 Click on the "View n submitted assignments" link. A summary table appears. 3 Click on the 'Status' column header, to sort the table by status. 4 Verify that the column sorts by status. 5 Click on any entry in the status column. 6 Verify that the page loads without error.
    • Workaround:
      Hide

      No workaround, but initially the table works, and can be sorted by other criteria without this issue.

      Show
      No workaround, but initially the table works, and can be sorted by other criteria without this issue.
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull from Repository:

      Description

      When ordering submitted assignments by status, an error is received:

      "Error reading from database - Unknown column 'status' in 'order clause'"

      Using the back button on this page causes the page which previously worked fine to fail with an identical error.

      Full error:

      Debug info: Unknown column 'status' in 'order clause'
      SELECT u.id,u.picture,u.firstname,u.lastname,u.imagealt,u.email,
      s.id AS submissionid, s.grade, s.submissioncomment,
      s.timemodified, s.timemarked FROM mdl_user u LEFT JOIN mdl_assignment_submissions s ON u.id = s.userid
      AND s.assignment = 591 WHERE u.id IN (631,868,2051,2057,2058,2070,2071,2087,2094,2095,2096,2097,2098,2099,2100,2102,2434,2436,2833,2836,2838,3112,3113,3115,3226,3373,3967,915,3930,4226) ORDER BY status ASC, lastname ASC
      [array (
      )]
      Stack trace:
       
          line 394 of /lib/dml/moodle_database.php: dml_read_exception thrown
          line 795 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
          line 1325 of /mod/assignment/lib.php: call to mysqli_native_moodle_database->get_records_sql()
          line 649 of /mod/assignment/lib.php: call to assignment_base->display_submissions()
          line 57 of /mod/assignment/submissions.php: call to assignment_base->submissions()

      Replication steps:

      1. Click on an Assignment activity with submitted assignments.
      2. Click on the "View n submitted assignments" link. A summary table appears. Note that at this point, everything is fine. The URL is along the lines of: http://moodle.domain.com/mod/assignment/submissions.php?id=29526
      3. Click on the 'Status' column header, to sort the table by status. At this point, the above error is received. (This page uses the URL: http://moodle.comain.com/mod/assignment/submissions.php?id=29526&currentgroup=&tsort=status)
      4. Clicking the browser's back button to get to the previously working page (with the URL as in 2, above) also now results in this error and stack trace.
      5. Logging out and in again (clearing the user session?) appears to slightly fix the issue: at least the page in 2, above, can be reached again.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  4 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    28/Nov/11