| Bug #79924 | Func CONVERT and CONVERT(,BINARY) works incorrect w/ multi-byte+multi-rows | ||
|---|---|---|---|
| Submitted: | 12 Jan 2016 6:38 | Modified: | 21 Jan 2016 23:04 |
| Reporter: | Su Dylan | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: DML | Severity: | S2 (Serious) |
| Version: | 5.7.8, 5.5.48, 5.6.28, 5.7.10 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[12 Jan 2016 7:29]
MySQL Verification Team
Hello Su Dylan, Thank you for the report and test case. Observed that 5.5.48/5.6.28/5.7.10 are affected. Thanks, Umesh
[21 Jan 2016 23:04]
Paul DuBois
Noted in 5.8.0 changelog. For calls to CONVERT(), literal string arguments could be modified during execution, producing incorrect results.

Description: Output: ===== mysql> create table t1(c1 int); Query OK, 0 rows affected (0.00 sec) mysql> insert into t1 values(1),(2),(3); Query OK, 3 rows affected (0.00 sec) Records: 3 Duplicates: 0 Warnings: 0 mysql> select convert( substr('大不列颠及北爱尔兰联合王国', 1, 15), BINARY) from t1; +----------------------------------------------------------------------------+ | convert( substr('大不列颠及北爱尔兰联合王国', 1, 15), BINARY) | +----------------------------------------------------------------------------+ | 大不列颠及北爱尔兰联合王国 | | 大不列颠及 | | 大不列颠及 | +----------------------------------------------------------------------------+ 3 rows in set (0.00 sec) Problem: ===== The select item is a constant, same result expected for each row. How to repeat: set names 'utf8'; drop table if exists t1; create table t1(c1 int); insert into t1 values(1),(2),(3); select convert( substr('大不列颠及北爱尔兰联合王国', 1, 15), BINARY) from t1; Suggested fix: '大不列颠及北爱尔兰联合王国' is returned for each row.