| Bug #86622 | Character comparison incorect | ||
|---|---|---|---|
| Submitted: | 8 Jun 2017 12:15 | Modified: | 7 Jan 2020 13:16 |
| Reporter: | Eimantas Jatkonis | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Charsets | Severity: | S3 (Non-critical) |
| Version: | 5.6, 5.7, 8.0 | OS: | Linux |
| Assigned to: | CPU Architecture: | Any | |
[8 Jun 2017 14:54]
MySQL Verification Team
Hi!
With 5.6.36, I got exactly the same results as you:
mysql> set names latin1;
Query OK, 0 rows affected (0.00 sec)
mysql> select 'T' = 't', 't' = 'T', 't' LIKE 'T', upper('t'),LOWER('T'), UPPER('t') = 'T';
+-----------+-----------+--------------+------------+------------+------------------+
| 'T' = 't' | 't' = 'T' | 't' LIKE 'T' | upper('t') | LOWER('T') | UPPER('t') = 'T' |
+-----------+-----------+--------------+------------+------------+------------------+
| 1 | 1 | 1 | T | t | 1 |
+-----------+-----------+--------------+------------+------------+------------------+
1 row in set (0.00 sec)
mysql> set names latin7;
Query OK, 0 rows affected (0.00 sec)
mysql> select 'T' = 't', 't' = 'T', 't' LIKE 'T', upper('t'),LOWER('T'), UPPER('t') = 'T';
+-----------+-----------+--------------+------------+------------+------------------+
| 'T' = 't' | 't' = 'T' | 't' LIKE 'T' | upper('t') | LOWER('T') | UPPER('t') = 'T' |
+-----------+-----------+--------------+------------+------------+------------------+
| 0 | 0 | 0 | T | t | 1 |
+-----------+-----------+--------------+------------+------------+------------------+
1 row in set (0.00 sec)
With 5.7.19 I got exactly the same result, so this is a verified bug. It is verified since . both in latin1 and latin7, small 't' and large 'T' have the same value.
[7 Jan 2020 13:16]
Eimantas Jatkonis
I tested with 8.0.18, same problem. Any workaround available?

Description: Standard symbols comparison is not working as expected if using latin7 connection. 't' is not LIKE 'T' in latin7, but is correct in latin1 or utf8. How to repeat: mysql> set names latin1; Query OK, 0 rows affected (0.00 sec) mysql> select 'T' = 't', 't' = 'T', 't' LIKE 'T', upper('t'), LOWER('T'), UPPER('t') = 'T'; +-----------+-----------+--------------+------------+------------+------------------+ | 'T' = 't' | 't' = 'T' | 't' LIKE 'T' | upper('t') | LOWER('T') | UPPER('t') = 'T' | +-----------+-----------+--------------+------------+------------+------------------+ | 1 | 1 | 1 | T | t | 1 | +-----------+-----------+--------------+------------+------------+------------------+ 1 row in set (0.00 sec) mysql> set names latin7; Query OK, 0 rows affected (0.00 sec) mysql> select 'T' = 't', 't' = 'T', 't' LIKE 'T', upper('t'), LOWER('T'), UPPER('t') = 'T'; +-----------+-----------+--------------+------------+------------+------------------+ | 'T' = 't' | 't' = 'T' | 't' LIKE 'T' | upper('t') | LOWER('T') | UPPER('t') = 'T' | +-----------+-----------+--------------+------------+------------+------------------+ | 0 | 0 | 0 | T | t | 1 | +-----------+-----------+--------------+------------+------------+------------------+ 1 row in set (0.00 sec) mysql> set names utf8; Query OK, 0 rows affected (0.00 sec) mysql> select 'T' = 't', 't' = 'T', 't' LIKE 'T', upper('t'), LOWER('T'), UPPER('t') = 'T'; +-----------+-----------+--------------+------------+------------+------------------+ | 'T' = 't' | 't' = 'T' | 't' LIKE 'T' | upper('t') | LOWER('T') | UPPER('t') = 'T' | +-----------+-----------+--------------+------------+------------+------------------+ | 1 | 1 | 1 | T | t | 1 | +-----------+-----------+--------------+------------+------------+------------------+ 1 row in set (0.00 sec)