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

Recent Activities report gives 'Error reading from database' for separate groups course

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.3, 2.1.1, 2.2
    • Fix Version/s: 2.0.5, 2.1.2
    • Component/s: Course
    • Labels:
    • Database:
      Any
    • Testing Instructions:
      Hide

      1. Create a course, set it as Separate Groups.
      2. Add Recent Activity block.
      3. Enrol users, add them to groups.
      4. Log in as a user, enter the course, click on "Full report of recent activity..."
      5. repeat the tests for all combinations of group modes+accessallgroups+groupings
      Example of output:

      Error reading from database

      More information about this error
      Debug info: ERROR: invalid input syntax for integer: "Array"
      SELECT u.id,u.picture,u.firstname,u.lastname,u.imagealt,u.email
      FROM mdl_user u
      JOIN (SELECT DISTINCT eu1_u.id
      FROM mdl_user eu1_u
      JOIN mdl_groups_members eu1_gm ON (eu1_gm.userid = eu1_u.id AND eu1_gm.groupid = $1)
      JOIN mdl_user_enrolments eu1_ue ON eu1_ue.userid = eu1_u.id
      JOIN mdl_enrol eu1_e ON (eu1_e.id = eu1_ue.enrolid AND eu1_e.courseid = $2)
      WHERE eu1_u.deleted = 0 AND eu1_u.id <> $3) je ON je.id = u.id
      WHERE u.deleted = 0 ORDER BY u.lastname ASC, u.firstname ASC
      [array (
      0 =>
      array (
      0 => 178,
      ),
      1 => '378',
      2 => '1',
      )]
      Stack trace:

      line 391 of /lib/dml/moodle_database.php: dml_read_exception thrown
      line 232 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
      line 678 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
      line 3259 of /lib/accesslib.php: call to pgsql_native_moodle_database->get_records_sql()
      line 63 of /course/recent_form.php: call to get_enrolled_users()
      line 152 of /lib/formslib.php: call to recent_form->definition()
      line 59 of /course/recent.php: call to moodleform->moodleform()

      Show
      1. Create a course, set it as Separate Groups. 2. Add Recent Activity block. 3. Enrol users, add them to groups. 4. Log in as a user, enter the course, click on "Full report of recent activity..." 5. repeat the tests for all combinations of group modes+accessallgroups+groupings Example of output: Error reading from database More information about this error Debug info: ERROR: invalid input syntax for integer: "Array" SELECT u.id,u.picture,u.firstname,u.lastname,u.imagealt,u.email FROM mdl_user u JOIN (SELECT DISTINCT eu1_u.id FROM mdl_user eu1_u JOIN mdl_groups_members eu1_gm ON (eu1_gm.userid = eu1_u.id AND eu1_gm.groupid = $1) JOIN mdl_user_enrolments eu1_ue ON eu1_ue.userid = eu1_u.id JOIN mdl_enrol eu1_e ON (eu1_e.id = eu1_ue.enrolid AND eu1_e.courseid = $2) WHERE eu1_u.deleted = 0 AND eu1_u.id <> $3) je ON je.id = u.id WHERE u.deleted = 0 ORDER BY u.lastname ASC, u.firstname ASC [array ( 0 => array ( 0 => 178, ), 1 => '378', 2 => '1', )] Stack trace: line 391 of /lib/dml/moodle_database.php: dml_read_exception thrown line 232 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end() line 678 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end() line 3259 of /lib/accesslib.php: call to pgsql_native_moodle_database->get_records_sql() line 63 of /course/recent_form.php: call to get_enrolled_users() line 152 of /lib/formslib.php: call to recent_form->definition() line 59 of /course/recent.php: call to moodleform->moodleform()
    • Workaround:
      Hide

      See the attached patch.

      Show
      See the attached patch.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w36_MDL-29131_m22_recentsep

      Description

      Recent Activities full report gives 'Error reading from database' for separate groups course

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            skodak Petr Skoda added a comment -

            to integrators: please cherry pick to all 2.x branches

            thanks a lot for the report and patch that clearly illustrated the problem, I have found some more issues and created a bit bigger patch that rewrites the group logic

            Show
            skodak Petr Skoda added a comment - to integrators: please cherry pick to all 2.x branches thanks a lot for the report and patch that clearly illustrated the problem, I have found some more issues and created a bit bigger patch that rewrites the group logic
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Thanks Petr - this has been integrated now and cherry-picked to 21, and 20.

            Testers: master, 21, and 20

            Show
            samhemelryk Sam Hemelryk added a comment - Thanks Petr - this has been integrated now and cherry-picked to 21, and 20. Testers: master, 21, and 20
            Hide
            rajeshtaneja Rajesh Taneja added a comment -

            Works Great.
            Thanks for fixing this Kirill and Petr

            Show
            rajeshtaneja Rajesh Taneja added a comment - Works Great. Thanks for fixing this Kirill and Petr
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            YTC !

            (aka, yay, thanks and ciao ) Closing.

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - YTC ! (aka, yay, thanks and ciao ) Closing.

              People

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

                Dates

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