Bug #83930 Wrong result when using like function with UCA collations
Submitted: 23 Nov 2016 9:54 Modified: 13 Dec 2016 17:26
Reporter: Xing Zhang Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Charsets Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[23 Nov 2016 9:54] Xing Zhang
Description:
When using LIKE function with UCA collations like utf8mb4_unicode_520_ci, utf8mb4_0900_ai_ci, the result might be wrong.

For example:
mysql> set names latin1;
Query OK, 0 rows affected (0.00 sec)

mysql> select 'a\\' like 'a\\';
+------------------+
| 'a\\' like 'a\\' |
+------------------+
|                1 |
+------------------+
1 row in set (0.00 sec)

mysql> set names utf8mb4 collate utf8mb4_unicode_520_ci;
Query OK, 0 rows affected (0.00 sec)

mysql> select 'a\\' like 'a\\';
+------------------+
| 'a\\' like 'a\\' |
+------------------+
|                0 |
+------------------+
1 row in set (0.00 sec)

Obviously the result with utf8mb4_unicode_520_ci is wrong.

How to repeat:
As in Description.

Suggested fix:
N / A
[13 Dec 2016 17:26] Paul DuBois
Posted by developer:
 
Noted in 8.0.1 changelog.

For UCA collations, LIKE comparisons against a pattern that ended
with the escape character returned incorrect results.