-
Bug
-
Resolution: Fixed
-
Critical
-
1.9.8, 2.0, 2.6.4, 2.7.1
-
MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
-
MOODLE_28_STABLE
-
MDL-22309_master -
-
BACKEND Sprint 18
When user has more than one role assigned, the query in get_role_users() gives more rows. Because $DB->get_records_sql() is used, it may lead to
Did you remember to make the first column something unique in your call to get_records? Duplicate value xxx found in column 'id'.
|
and only record per-user being returned. Using DISTINCT here would not work because every row has different role. Also, DISTINCT in combination with ORDER BY ir dangerous in PostgreSQL unless we make sure that ORDER BY fields are includes in SELECTed fields.
Reproduce:
=========
1. Assign yourself both Teacher and Student in a course
2. Visit the course settings page (with debugging on, of course)
- Discovered while testing
-
MDL-47076 Badges creator being set to 0 on backup restoration
-
- Closed
-
- has a non-specific relationship to
-
MDL-46931 Duplicate get_records key column in users selector
-
- Closed
-
-
MDL-21567 At module level, 'Assign roles' screens display user twice if they have two roles at course level
-
- Closed
-
-
MDL-35908 get_role_users() can generate SQL error on MS-SQL
-
- Closed
-
- has been marked as being related by
-
MDL-49613 count_role_users gives unexpected results
-
- Closed
-
- is duplicated by
-
MDL-42595 "Did you remember to make the first column something unique" in get_role_users() for users with multiple roles
-
- Closed
-
-
MDL-48176 get_role_users() (lib/accesslib.php) can return duplicate IDs.
-
- Closed
-
- will help resolve
-
MDL-29902 Course search results in debugging notice
-
- Closed
-