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

Logically invalid SQL

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.8.5, 2.9, 3.0
    • 2.8.7, 2.9.1
    • Gradebook
    • MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE
    • MOODLE_28_STABLE, MOODLE_29_STABLE
    • 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

    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

            skylarkelty Skylar Kelty
            skylarkelty Skylar Kelty
            Ankit Agarwal Ankit Agarwal
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Rajesh Taneja Rajesh Taneja
            Adrian Greeve, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              6/Jul/15