-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The function upper
produces error for some special characters
#32488
Comments
The root cause is here: tidb/expression/builtin_string_vec.go Lines 146 to 155 in 171a354
In line 147, we reserved the space according to the original character, but the length of its upper case may larger. |
/assign |
Similar problems may also occur in the select binary 'İ'; -- 0xC4B0
select binary lower('İ'); -- 0x69 |
Some results of Some of results:
|
In my local mysql (version: 8.0.23) , it return s the result:
The behavior is the same with tidb. |
My MySQL version is 8.0.28, and I tried it in MySQL 8.0.23. I think the result is based on charset and collation. MySQL:
mysql> set names utf8mb4 collate utf8mb4_bin;
Query OK, 0 rows affected (0.00 sec)
mysql> select binary upper('\U+AB91');
+---------------------+
| binary upper('ꮑ') |
+---------------------+
| ꮑ |
+---------------------+
1 row in set, 1 warning (0.00 sec)
mysql> set names utf8mb4 collate utf8mb4_0900_ai_ci;
Query OK, 0 rows affected (0.00 sec)
mysql> select binary upper('\U+AB91');
+---------------------+
| binary upper('ꮑ') |
+---------------------+
| Ꮑ |
+---------------------+
1 row in set, 1 warning (0.00 sec) |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
With
new_collation_enabled
isTrue
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
master. But I think it effects all tidb versions
mysql> SELECT tidb_version();
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: None
Edition: Community
Git Commit Hash: None
Git Branch: None
UTC Build Time: None
GoVersion: go1.16.3
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.03 sec)
The text was updated successfully, but these errors were encountered: