Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Duplicate
-
10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL)
-
Windows 2012 R2 Server, Ubuntu LTS 16.04.2
Description
I found out there is different behavior in different collations for UTF8 escape wildcard LIKE matching.
mysql> SET collation_connection = utf8_unicode_ci;
|
Query OK, 0 rows affected (0.00 sec)
|
|
mysql> SELECT '\%b' LIKE '%\%';
|
+------------------+
|
| '\%b' LIKE '%\%' |
|
+------------------+
|
| 1 |
|
+------------------+
|
1 row in set (0.00 sec)
|
|
mysql> SET collation_connection = utf8_general_ci;
|
Query OK, 0 rows affected (0.00 sec)
|
|
mysql> SELECT '\%b' LIKE '%\%';
|
+------------------+
|
| '\%b' LIKE '%\%' |
|
+------------------+
|
| 0 |
|
+------------------+
|
1 row in set (0.00 sec)
|
|
mysql> SET collation_connection = utf8mb4_unicode_ci;
|
Query OK, 0 rows affected (0.00 sec)
|
|
mysql> SELECT '\%b' LIKE '%\%';
|
+------------------+
|
| '\%b' LIKE '%\%' |
|
+------------------+
|
| 1 |
|
+------------------+
|
1 row in set (0.00 sec)
|
|
mysql> SET collation_connection = utf8mb4_general_ci;
|
Query OK, 0 rows affected (0.00 sec)
|
|
mysql> SELECT '\%b' LIKE '%\%';
|
+------------------+
|
| '\%b' LIKE '%\%' |
|
+------------------+
|
| 0 |
|
+------------------+
|
1 row in set (0.00 sec)
|
|
mysql> SET collation_connection = utf8mb4_unicode_520_ci;
|
Query OK, 0 rows affected (0.00 sec)
|
|
mysql> SELECT '\%b' LIKE '%\%';
|
+------------------+
|
| '\%b' LIKE '%\%' |
|
+------------------+
|
| 1 |
|
+------------------+
|
1 row in set (0.00 sec)
|
I found out this problem on MySQL for a long time ago, but it says to use another collation instead, is there any ways to solve it?
Attachments
Issue Links
- duplicates
-
MDEV-17064 LIKE function has error behavior on the fields in which the collation is xxx_unicode_xx
-
- Closed
-
- links to
Activity
Field | Original Value | New Value |
---|---|---|
Description |
I found out there is different behavior in different collations for UTF8 escape wildcard LIKE matching.
{{mysql> SET collation_connection = utf8_unicode_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8_general_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 0 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_unicode_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_general_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 0 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_unicode_520_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) }} I found out this [problem|https://bugs.mysql.com/bug.php?id=74901] on MySQL for a long time ago, but it says to use another collation instead, is there any ways to solve it? |
I found out there is different behavior in different collations for UTF8 escape wildcard LIKE matching.
mysql> SET collation_connection = utf8_unicode_ci; Query OK, 0 rows affected (0.00 sec) {{ mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8_general_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 0 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_unicode_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_general_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 0 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_unicode_520_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) }} I found out this [problem|https://bugs.mysql.com/bug.php?id=74901] on MySQL for a long time ago, but it says to use another collation instead, is there any ways to solve it? |
Description |
I found out there is different behavior in different collations for UTF8 escape wildcard LIKE matching.
mysql> SET collation_connection = utf8_unicode_ci; Query OK, 0 rows affected (0.00 sec) {{ mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8_general_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 0 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_unicode_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_general_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 0 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_unicode_520_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) }} I found out this [problem|https://bugs.mysql.com/bug.php?id=74901] on MySQL for a long time ago, but it says to use another collation instead, is there any ways to solve it? |
I found out there is different behavior in different collations for UTF8 escape wildcard LIKE matching.
mysql> SET collation_connection = utf8_unicode_ci; Query OK, 0 rows affected (0.00 sec) {code:console} mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8_general_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 0 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_unicode_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_general_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 0 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_unicode_520_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) {code} I found out this [problem|https://bugs.mysql.com/bug.php?id=74901] on MySQL for a long time ago, but it says to use another collation instead, is there any ways to solve it? |
Description |
I found out there is different behavior in different collations for UTF8 escape wildcard LIKE matching.
mysql> SET collation_connection = utf8_unicode_ci; Query OK, 0 rows affected (0.00 sec) {code:console} mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8_general_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 0 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_unicode_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_general_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 0 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_unicode_520_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) {code} I found out this [problem|https://bugs.mysql.com/bug.php?id=74901] on MySQL for a long time ago, but it says to use another collation instead, is there any ways to solve it? |
I found out there is different behavior in different collations for UTF8 escape wildcard LIKE matching.
{code:console} mysql> SET collation_connection = utf8_unicode_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8_general_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 0 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_unicode_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_general_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 0 | +------------------+ 1 row in set (0.00 sec) mysql> SET collation_connection = utf8mb4_unicode_520_ci; Query OK, 0 rows affected (0.00 sec) mysql> SELECT '\%b' LIKE '%\%'; +------------------+ | '\%b' LIKE '%\%' | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec) {code} I found out this [problem|https://bugs.mysql.com/bug.php?id=74901] on MySQL for a long time ago, but it says to use another collation instead, is there any ways to solve it? |
Assignee | Alice Sherepa [ alice ] |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Labels | upstream |
Affects Version/s | 10.0 [ 16000 ] | |
Affects Version/s | 10.1 [ 16100 ] | |
Affects Version/s | 10.2 [ 14601 ] | |
Affects Version/s | 10.3 [ 22126 ] |
Remote Link | This issue links to "mysql (Web Link)" [ 28009 ] |
Fix Version/s | 10.2 [ 14601 ] | |
Assignee | Alice Sherepa [ alice ] | Alexander Barkov [ bar ] |
Priority | Major [ 3 ] | Minor [ 4 ] |
Link |
This issue duplicates |
Fix Version/s | N/A [ 14700 ] | |
Fix Version/s | 10.2 [ 14601 ] | |
Resolution | Duplicate [ 3 ] | |
Status | Confirmed [ 10101 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 81685 ] | MariaDB v4 [ 152495 ] |
reproduced as described on MariaDB 10.2.7, 10.1.25, 10.3.1