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

sql_like() fails under utf8_bin collation in mysql

    XMLWordPrintable

Details

    Description

      I've encountered the following use case in my testing environment:

      1. I'm using mysql
      2. My default collation is set to utf8_bin in order to resolve various database collation unit testing issues
      3. I'm building a query which is both case insensitive and accent insensitive

      The case insensitive + accent sensitive lowercases the strings and then sets the utf8_bin collation. Case insensitive + accent insensitive does neither; probably because with either utf8_general_ci or utf8_unicode_ci this query will work as expected.

      The unit test coverage doesn't include this use case (false, false) but it probably should. One way to fix this would be to explicitly declare one of the two standard collations. This isn't a big deal, but if anyone's running on utf8_bin or using a test system for development it's an unexpected gotcha.

      Attachments

        Activity

          People

            cfulton Charles Fulton
            cfulton Charles Fulton
            Jun Pataleta Jun Pataleta
            Dan Poltawski Dan Poltawski
            Rajesh Taneja Rajesh Taneja
            Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo
            Votes:
            3 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              9/Nov/15