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

"Did you remember to make the first column something unique" in get_role_users() for users with multiple roles

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.5.2, 2.6.4, 2.7.1
    • Libraries
    • None
    • MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE

      I have a course where a user has multiple roles.
      I fetch the users with specific roles (including the roles which my user has) of a course:
      $courseteachers = get_role_users(array('1', '2', '3'), context_course::instance(42), true);

      Then there is a debug message complaining about the SQL query:

      Did you remember to make the first column something unique in your call to get_records? Duplicate value '458' found in column 'id'.
      line 780 of /lib/dml/pgsql_native_moodle_database.php: call to debugging()
      line 3974 of /lib/accesslib.php: call to pgsql_native_moodle_database->get_records_sql()
      line 395 of /blocks/course_overview_campus/block_course_overview_campus.php: call to get_role_users()
      line 292 of /blocks/moodleblock.class.php: call to block_course_overview_campus->get_content()
      line 238 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
      line 951 of /lib/blocklib.php: call to block_base->get_content_for_output()
      line 1003 of /lib/blocklib.php: call to block_manager->create_block_contents()
      line 355 of /lib/outputrenderers.php: call to block_manager->ensure_content_created()
      line 45 of /theme/clean/layout/columns3.php: call to core_renderer->standard_head_html()
      line 860 of /lib/outputrenderers.php: call to include()
      line 790 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
      line 153 of /my/index.php: call to core_renderer->header()

      I think get_role_users() should be optimized to get rid of this debug message.

            Unassigned Unassigned
            abias Alexander Bias
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.