Bug #116522 | Concatenate char and binary, return data type with incorrect length | ||
---|---|---|---|
Submitted: | 1 Nov 2024 7:13 | Modified: | 4 Nov 2024 2:56 |
Reporter: | li liu | Email Updates: | |
Status: | Unsupported | Impact on me: | |
Category: | MySQL Server: Data Types | Severity: | S3 (Non-critical) |
Version: | 5.7.44 | OS: | CentOS |
Assigned to: | CPU Architecture: | Any |
[1 Nov 2024 7:13]
li liu
[1 Nov 2024 11:00]
MySQL Verification Team
Hi Mr. Liu, Thank you for your bug report. However, version 5.7 is not supported for several years , so far ..... Also, you are trying an operation on the two different data types. This is forbidden, according to SQL standard. MySQL does what it can, but mixing different data types never lead to the desired result. Trying using the CAST functionality, as described in our Reference Manual. Unsupported.
[4 Nov 2024 2:56]
li liu
Thank you very much for your reply I performed the same operation on MySQL version 8.0.40 and obtained a reasonable return result. The new version has fixed this defect mysql> create table t1(c1 char(10), c2 binary(10)); Query OK, 0 rows affected (0.06 sec) mysql> insert into t1 values('一二三四五六七八九十','1234567890'); Query OK, 1 row affected (0.01 sec) mysql> create view v1 as select concat(c1,c2) as col from t1; Query OK, 0 rows affected (0.01 sec) mysql> desc v1; +-------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+---------------+------+-----+---------+-------+ | col | varbinary(40) | YES | | NULL | | +-------+---------------+------+-----+---------+-------+ 1 row in set (0.00 sec) mysql> create table t2 as select concat(c1,c2) as col from t1; Query OK, 1 row affected (0.03 sec) Records: 1 Duplicates: 0 Warnings: 0 mysql> exit Bye [yashan_sa@AchorBase ~]$ mysql --version mysql Ver 8.0.40 for Linux on x86_64 (MySQL Community Server - GPL)