-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Labels
help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
Description
The built-in function concat() is not fully compatible with MySQL.
According to MySQL's concat() document:
If the arguments include any binary strings, the result is a binary string.
drop table if exists t;
create table t (a char(255) charset gbk, b binary(8));
insert into t values ('中文', 0x35);
select concat(a, b) from t;Excepted result(MySQL 8.0.25):
mysql> select concat(a, b) from t;
+----------------------------+
| concat(a, b) |
+----------------------------+
| 0xD6D0CEC43500000000000000 |
+----------------------------+Note that the first bytes are D6D0CEC4, which is GBK encoding bytes for 中文.
This special handling for binary literal also applies to input:
select concat(a, 0xd6d0cec4) from t;
+-----------------------+
| concat(a, 0xd6d0cec4) |
+-----------------------+
| 中文中文 |
+-----------------------+Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.