Bug #79909 Get mess code for func INSERT() with str as int const and newstr as multi-byte
Submitted: 11 Jan 2016 6:23 Modified: 5 Oct 2020 12:18
Reporter: Su Dylan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.7.8, 5.5.48, 5.6.28, 5.7.10 OS:Any
Assigned to: CPU Architecture:Any

[11 Jan 2016 6:23] Su Dylan
Description:
Output:
=====
mysql> set names 'utf8';
Query OK, 0 rows affected (0.00 sec)

mysql> select INSERT( 1, 1, 2, '中文' );
+-----------------------------+
| INSERT( 1, 1, 2, '中文' ) |
+-----------------------------+
| 中文              |
+-----------------------------+
1 row in set (0.00 sec)

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.7.8-rc  |
+-----------+
1 row in set (0.00 sec)

Problem:
=====
'中文' is expected.

How to repeat:
set names 'utf8';
select INSERT( 1, 1, 2, '中文' );

Suggested fix:
'中文' is returned.
[11 Jan 2016 8:27] MySQL Verification Team
Hello Su Dylan,

Thank you for the report and test case.
Observed that 5.5.48,5.6.28 and 5.7.10 are affected.

Thanks,
Umesh
[5 Oct 2020 12:18] Paul DuBois
Posted by developer:
 
Fixed in 8.0.23.

The INSERT() function did not correctly set the character set of the
result.