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

SQL error when searching users with custom profile fields on Grader report page

XMLWordPrintable

    • MOODLE_402_STABLE
    • MOODLE_402_STABLE
    • Hide
      1. Log in as admin
      2. Navigate to Users > Accounts > User profile fields in site administration
      3. Create a new Text input field
        • Character limit: 128
      4. Navigate to Users > Permissions > User policies in site administration
      5. Select new custom field in Show user identity and save changes
      6. Create two new users
        • Test One
        • Test Two
      7. Create a course
      8. Enrol each user as a student in the course
      9. Navigate to Grades
      10. Enter "One" in Search users field
      11. Press the View all results for "One" link in the dropdown
      12. Confirm the page loads showing only user "Test One"
      Show
      Log in as admin Navigate to Users > Accounts > User profile fields in site administration Create a new Text input field Character limit: 128 Navigate to Users > Permissions > User policies in site administration Select new custom field in Show user identity and save changes Create two new users Test One Test Two Create a course Enrol each user as a student in the course Navigate to Grades Enter "One" in Search users field Press the View all results for "One" link in the dropdown Confirm the page loads showing only user "Test One"

      • Create a course
      • Enrol some users
      • Create a custom user profile field of type text input with character limit like 10 (it only allows display user profiles of certain limit)
      • On user policies page tick you new field in 'Show user identity' and save changes
      • Go to grader report
      • Enter some string in search input and click 'View results for YOURSTRING'

      There will be an exception like this:

       

      Debug info: ERROR: missing FROM-clause entry for table "uf1d_1"
      LINE 14: ... $6 ESCAPE '\' OR idnumber ILIKE $7 ESCAPE '\' OR uf1d_1.dat...
      ^
      SELECT DISTINCT u.id
      FROM mdl_user u
      JOIN (SELECT DISTINCT eu1_u.id
      FROM mdl_user eu1_u
      JOIN mdl_user_enrolments ej1_ue ON ej1_ue.userid = eu1_u.id
      JOIN mdl_enrol ej1_e ON (ej1_e.id = ej1_ue.enrolid AND ej1_e.courseid = $1)
      WHERE 1 = 1 AND eu1_u.deleted = 0) je
      ON je.id = u.id
      JOIN mdl_role_assignments ra
      ON u.id = ra.userid
       
      WHERE ra.roleid = $2
      AND u.deleted = 0
      AND ( '' || COALESCE(u.firstname, $3) || ' ' || COALESCE(u.lastname, $4) ILIKE $5 ESCAPE '\' OR email ILIKE $6 ESCAPE '\' OR idnumber ILIKE $7 ESCAPE '\' OR uf1d_1.data ILIKE $8 ESCAPE '\')
       
      AND ra.contextid IN ($9,$10,$11)
      [array (
      0 => '2',
      1 => '5',
      2 => '',
      3 => '',
      4 => '%h%',
      5 => '%h%',
      6 => '%h%',
      7 => '%h%',
      8 => '30',
      9 => '3',
      10 => '1',
      )]
      Error code: dmlreadexception 

            pholden Paul Holden
            ilyatregubov Ilya Tregubov
            Ilya Tregubov Ilya Tregubov
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 21 minutes
                1h 21m

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