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

Logically invalid SQL

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8.5, 2.9, 3.0
    • Fix Version/s: 2.8.7, 2.9.1
    • Component/s: Gradebook
    • Labels:
    • Testing Instructions:
      Hide

      Do a quick regression test on grade history report. If you have significant gradebook history, you should notice slight performance increase

      Show
      Do a quick regression test on grade history report. If you have significant gradebook history, you should notice slight performance increase
    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      There is a logically-flawed join in the grade history report (/grade/report/history/classes/output/tablelog.php @ 416).

      • We ALWAYS filter on gi.courseid (see line 330 in get_filters_sql_and_params)
      • We LEFT JOIN grade_items gi

      This doesn't make sense as a grade_items row will ALWAYS be required due to the filter on gi.courseid (Left joins include null rows and null can never be equal to a courseid).

      Therefore..

      LEFT JOIN grade_items gi ON gi.id = ggh.itemid
      

      should become:

      JOIN grade_items gi ON gi.id = ggh.itemid
      

      This doesn't actually make any noticeable difference, but should help optimisers pick better query paths.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                6/Jul/15