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

SQL problem in grader report search

XMLWordPrintable

      This is a regression caused by MDL-76143 (user search in grader report).

      SQL*Server is failing consistently since few days ago, see:

      Link: https://ci.moodle.org/job/W.03.04%20-%20Behat%20-%20Chrome%20+%20MSSQL/1525/

      001 Scenario: A teacher can view and trigger the user search # /var/www/html/grade/report/grader/tests/behat/tertiary_navigation_searching.feature:37
            And I click on "Turtle Manatee" "list_item"            # /var/www/html/grade/report/grader/tests/behat/tertiary_navigation_searching.feature:55
              Moodle exception: Error reading from database More information about this error
              
              Error reading from database
              More information about this error
              
              
                  
              Debug info: 
               SQLState: 42000<br>
              Error Code: 447<br>
              Message: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Expression type bigint is invalid for COLLATE clause.<br>
              SELECT DISTINCT u.id
                                     FROM b_2_user u
                                     JOIN (SELECT DISTINCT eu1_u.id
                            FROM b_2_user eu1_u
                          JOIN b_2_user_enrolments ej1_ue ON ej1_ue.userid = eu1_u.id
              JOIN b_2_enrol ej1_e ON (ej1_e.id = ej1_ue.enrolid AND ej1_e.courseid = '2')
                           WHERE 1 = 1 AND eu1_u.deleted = 0) je
                                          ON je.id = u.id
                                     JOIN b_2_role_assignments ra
                                          ON u.id = ra.userid
                                     
                                    WHERE ra.roleid = '5'
                                          AND u.deleted = 0
                                           AND u.id COLLATE Latin1_General_CS_AS = '8'
                                          
                                          AND ra.contextid IN ('11','3','1')
              [array (
                0 => '2',
                1 => '5',
                2 => 8,
                3 => '11',
                4 => '3',
                5 => '1',
              )]
              Error code: dmlreadexception
                  
                      
              ×
                      
              Dismiss this notification
                  
               
              	* line 494 of /lib/dml/moodle_database.php: dml_read_exception thrown
              	* line 331 of /lib/dml/sqlsrv_native_moodle_database.php: call to
              moodle_database->query_end()
              	* line 438 of /lib/dml/sqlsrv_native_moodle_database.php: call to
              sqlsrv_native_moodle_database->query_end()
              	* line 907 of /lib/dml/sqlsrv_native_moodle_database.php: call to
              sqlsrv_native_moodle_database->do_query()
              	* line 983 of /lib/dml/sqlsrv_native_moodle_database.php: call to
              sqlsrv_native_moodle_database->get_recordset_sql()
              	* line 393 of /grade/report/lib.php: call to
              sqlsrv_native_moodle_database->get_records_sql()
              	* line 129 of /grade/report/grader/index.php: call to
              grade_report->get_numusers()
               (Exception)
      

      To reproduce it, just run behat with SQL*Server and --name 'Within the grader report, test that we can search for users' and the above will happen.

            mathewmay Glyn (Mathew) May
            stronk7 Eloy Lafuente (stronk7)
            Paul Holden Paul Holden
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours, 25 minutes
                6h 25m

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