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

sql error in online block when separate group mode enabled

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0, 2.0.1
    • Fix Version/s: 2.0.2
    • Component/s: Blocks
    • Labels:
      None
    • Environment:
      Moodle 2.0.1, Linux CentOS, Apache, MySQL 5.0.91, PHP 5.2.14.
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      Following debug msg is rcvd when new user tries to access course that they've been manually enrolled in.

      1. Add new user
      2. Manually enrolling them in a course
      3. Login as new user and try access course

      Debug info: Unknown column 'u.id' in 'on clause'
      SELECT u.id,u.picture,u.firstname,u.lastname,u.imagealt,u.email,u.username, MAX(ul.timeaccess) AS lastaccess
      FROM mdl_user_lastaccess ul, mdl_user u , mdl_groups_members gm
      JOIN (SELECT DISTINCT eu1_u.id
      FROM mdl_user eu1_u
      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 = ?)
      WHERE eu1_u.deleted = 0 AND eu1_u.id <> ?) euj ON euj.id = u.id
      WHERE ul.timeaccess > 1295354600
      AND u.id = ul.userid
      AND ul.courseid = ?
      AND u.id = gm.userid AND gm.groupid = ?
      GROUP BY u.id,u.picture,u.firstname,u.lastname,u.imagealt,u.email,u.username
      ORDER BY lastaccess DESC LIMIT 0, 50
      [array (
      0 => '7',
      1 => '1',
      2 => '7',
      3 => 0,
      )]
      Stack trace:
      line 391 of /lib/dml/moodle_database.php: dml_read_exception thrown
      line 769 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 114 of /blocks/online_users/block_online_users.php: call to mysqli_native_moodle_database->get_records_sql()
      line 279 of /blocks/moodleblock.class.php: call to block_online_users->get_content()
      line 232 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
      line 895 of /lib/blocklib.php: call to block_base->get_content_for_output()
      line 947 of /lib/blocklib.php: call to block_manager->create_block_contents()
      line 342 of /lib/blocklib.php: call to block_manager->ensure_content_created()
      line 7 of /theme/base/layout/general.php: call to block_manager->region_has_content()
      line 647 of /lib/outputrenderers.php: call to include()
      line 605 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
      line 1200 of /lib/setuplib.php: call to core_renderer->header()
      line 196 of /course/view.php: call to bootstrap_renderer->__call()
      line 196 of /course/view.php: call to bootstrap_renderer->header()

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            chadsta Chad Outten added a comment -

            Changed issue component. Should also mention this debug info was produced after recent upgrade from 1.9.9 to 2.0.

            Show
            chadsta Chad Outten added a comment - Changed issue component. Should also mention this debug info was produced after recent upgrade from 1.9.9 to 2.0.
            Hide
            chadsta Chad Outten added a comment -

            find below results of functional database test.

            Running tests on: Current database (native/mysqli)

            Fail: lib/dml/simpletest/testdml.php / ▶ dml_test / ▶ test_unique_index_collation_trouble
            Unique index is accent insensitive, this may cause problems for non-ascii languages. This is usually caused by accent insensitive default collation. at [/home/creative/public_html/lib/dml/simpletest/testdml.php line 2769]
            Exception: lib/dml/simpletest/testdml.php / ▶ dml_test / ▶ test_unique_index_collation_trouble
            Unexpected exception of type [dml_write_exception] with message [Error writing to database] in [/home/creative/public_html/lib/dml/moodle_database.php line 394]
            Debug info:
            Duplicate entry 'aäa' for key 2
            INSERT INTO mdl_unit_table (name) VALUES
            [array (
            0 => 'aäa',
            )]
            line 853 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
            line 895 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
            line 2763 of /lib/dml/simpletest/testdml.php: call to mysqli_native_moodle_database->insert_record()
            line ... of ...
            Fail: lib/dml/simpletest/testdml.php / ▶ dml_test / ▶ test_sql_binary_equal
            SQL operator "=" is expected to be accent sensitive at [/home/creative/public_html/lib/dml/simpletest/testdml.php line 2797]
            Fail: lib/dml/simpletest/testdml.php / ▶ dml_test / ▶ test_sql_binary_equal
            SQL operator "=" is expected to be case sensitive at [/home/creative/public_html/lib/dml/simpletest/testdml.php line 2800]
            2/2 test cases complete: 962 passes, 3 fails and 1 exceptions.
            Run at Wednesday, 19 January 2011, 06:53 AM. Time taken: 7 secs. Using SimpleTest version 1.0.1.

            Show
            chadsta Chad Outten added a comment - find below results of functional database test. — Running tests on: Current database (native/mysqli) Fail: lib/dml/simpletest/testdml.php / ▶ dml_test / ▶ test_unique_index_collation_trouble Unique index is accent insensitive, this may cause problems for non-ascii languages. This is usually caused by accent insensitive default collation. at [/home/creative/public_html/lib/dml/simpletest/testdml.php line 2769] Exception: lib/dml/simpletest/testdml.php / ▶ dml_test / ▶ test_unique_index_collation_trouble Unexpected exception of type [dml_write_exception] with message [Error writing to database] in [/home/creative/public_html/lib/dml/moodle_database.php line 394] Debug info: Duplicate entry 'aäa' for key 2 INSERT INTO mdl_unit_table (name) VALUES [array ( 0 => 'aäa', )] line 853 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end() line 895 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw() line 2763 of /lib/dml/simpletest/testdml.php: call to mysqli_native_moodle_database->insert_record() line ... of ... Fail: lib/dml/simpletest/testdml.php / ▶ dml_test / ▶ test_sql_binary_equal SQL operator "=" is expected to be accent sensitive at [/home/creative/public_html/lib/dml/simpletest/testdml.php line 2797] Fail: lib/dml/simpletest/testdml.php / ▶ dml_test / ▶ test_sql_binary_equal SQL operator "=" is expected to be case sensitive at [/home/creative/public_html/lib/dml/simpletest/testdml.php line 2800] 2/2 test cases complete: 962 passes, 3 fails and 1 exceptions. Run at Wednesday, 19 January 2011, 06:53 AM. Time taken: 7 secs. Using SimpleTest version 1.0.1.
            Hide
            skodak Petr Skoda added a comment -

            I have managed to reproduce it, this happens if you use the online_block and set forced separate group mode in course

            working on a fix, thanks for the report...

            Show
            skodak Petr Skoda added a comment - I have managed to reproduce it, this happens if you use the online_block and set forced separate group mode in course working on a fix, thanks for the report...
            Hide
            skodak Petr Skoda added a comment -

            Workaround is to remove/disable the online block.

            Show
            skodak Petr Skoda added a comment - Workaround is to remove/disable the online block.
            Hide
            skodak Petr Skoda added a comment -

            patch is here: https://github.com/skodak/moodle/compare/master...MDL-26045_20_wip_onlineblock

            This fix will be available in the weekly build next week.

            Thanks for the report.

            Show
            skodak Petr Skoda added a comment - patch is here: https://github.com/skodak/moodle/compare/master...MDL-26045_20_wip_onlineblock This fix will be available in the weekly build next week. Thanks for the report.
            Hide
            chadsta Chad Outten added a comment -

            Ok, Petr. Thanks for heads up. Suggested workaround seems to resolve described issue.

            Show
            chadsta Chad Outten added a comment - Ok, Petr. Thanks for heads up. Suggested workaround seems to resolve described issue.
            Hide
            tsala Helen Foster added a comment -

            Chad, thanks for your report and Petr, thanks for fixing it.

            Show
            tsala Helen Foster added a comment - Chad, thanks for your report and Petr, thanks for fixing it.

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  21/Feb/11