Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-17064

LIKE function has error behavior on the fields in which the collation is xxx_unicode_xx

    XMLWordPrintable

    Details

      Description

      MariaDB [(none)]> use test;
      Database changed
       
      MariaDB [test]> create table like_test(name varchar(20) character set 'utf8' collate 'utf8_unicode_ci');
      Query OK, 0 rows affected (0.012 sec)
       
      MariaDB [test]> insert into like_test values('radio! test');
      Query OK, 1 row affected (0.003 sec)
       
      MariaDB [test]> select * from like_test where name like '%!!%' escape '!';
      Empty set (0.002 sec) -- this is wrong!
       
      MariaDB [test]> ALTER TABLE like_test CHANGE COLUMN name name VARCHAR(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
      Query OK, 1 row affected (0.032 sec)
      Records: 1  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> select * from like_test where name like '%!!%' escape '!';
      +-------------+
      | name        |
      +-------------+
      | radio! test |
      +-------------+
      1 row in set (0.001 sec)
      

      I still get empty set when I alter the collation of the field "name" to utf8_unicode_520_ci, utf8mb4_unicode_ci, utf8mb4_unicode_520_ci. But all work fine on utf8_general_ci, utf8mb4_general_ci.

      Pls forgive me for my bad english.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bar Alexander Barkov
              Reporter:
              tiantang811 Tao Su
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: