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

get_collation() returns an invalid collation name on sqlsrv

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a bug
    • Icon: Minor Minor
    • None
    • 3.1.3
    • Database SQL/XMLDB
    • Windows Server 2016 (Standard), 64-bit

      Using Moodle 3.1.3+ with version 4.1.4 of the SQL Server drivers for PHP (sqlsrv) and SQL Server 2016, the following can be seen when running the tests:

      2) core_dml_testcase::test_sql_like
      dml_read_exception: Error reading from database (SQLState: 42000<br>
      Error Code: 448<br>
      Message: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Invalid collation 'SQL_Latin1_General_CP1_CS_AI'.<br>
       
      SELECT * FROM phpu_test_table WHERE name COLLATE SQL_Latin1_General_CP1_CS_AI LIKE N'aui' ESCAPE '\'
      [array (
       0 => 'aui',
      )])
       
      C:\Users\moodle\htdocs\lib\dml\moodle_database.php:474
      C:\Users\moodle\htdocs\lib\dml\sqlsrv_native_moodle_database.php:291
      C:\Users\moodle\htdocs\lib\dml\sqlsrv_native_moodle_database.php:398
      C:\Users\moodle\htdocs\lib\dml\sqlsrv_native_moodle_database.php:859
      C:\Users\moodle\htdocs\lib\dml\sqlsrv_native_moodle_database.php:907
      C:\Users\moodle\htdocs\lib\dml\tests\dml_test.php:3910
      C:\Users\moodle\htdocs\lib\phpunit\classes\database_driver_testcase.php:143
       
      To re-run:
      C:\Users\moodle\htdocs\vendor\bin\/../phpunit/phpunit/phpunit core_dml_testcase lib\dml\tests\dml_test.php
      

      It seems as though get_collation() fails to strip the SQL_ prefix off of the collation name before using the COLLATION clause with the value it retrieved.

            lukecarrier Luke Carrier
            lukecarrier Luke Carrier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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