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

News forum items with ratings report DB errors

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.1.1, 2.2
    • Fix Version/s: 2.1.2
    • Component/s: Forum, Ratings
    • Labels:
    • Database:
      PostgreSQL
    • Testing Instructions:
      Hide

      1. set up a moodle site using postgresql as the database if you dont already have one
      2. access a forum and submit a rating
      3. check that the aggregate updates appropriately (assuming your use has the capabilities required to see the aggregate)

      Show
      1. set up a moodle site using postgresql as the database if you dont already have one 2. access a forum and submit a rating 3. check that the aggregate updates appropriately (assuming your use has the capabilities required to see the aggregate)
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE
    • Pull Master Branch:
      MDL-27845_rating_aggregation

      Description

      I got this error when access news forum: Debug info:

      ERROR: column "ur.rating" must appear in the GROUP BY clause or be used in an aggregate function
      LINE 3: ... ur.id, ur.userid, ur.scaleid, ur.rating ...
      ^
      SELECT r.itemid, r.component, r.ratingarea, r.contextid,
      AVG(r.rating) AS aggrrating, COUNT(r.rating) AS numratings,
      ur.id, ur.userid, ur.scaleid, ur.rating AS usersrating
      FROM mdl_rating r
      LEFT JOIN mdl_rating ur ON ur.contextid = r.contextid AND
      ur.itemid = r.itemid AND
      ur.component = r.component AND
      ur.ratingarea = r.ratingarea AND
      ur.userid = $1
      WHERE r.contextid = $2 AND
      r.itemid = $3 AND
      r.component = $4 AND
      r.ratingarea = $5
      GROUP BY r.itemid, r.component, r.ratingarea, r.contextid, ur.id, ur.userid, ur.scaleid
      ORDER BY r.itemid
      [array (
      0 => '2',
      1 => '28',
      2 => '31',
      3 => 'mod_forum',
      4 => 'post',
      )]

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    10/Oct/11