Bug #118400 ERROR 3854 (HY000): Cannot convert string '\xF0\x9F\x98\xA6\xF0\x9F...' from utf8mb4 to latin1
Submitted: 9 Jun 13:34 Modified: 9 Jun 13:56
Reporter: Alice Alice Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:8.0.41 OS:Linux
Assigned to: CPU Architecture:x86

[9 Jun 13:34] Alice Alice
Description:
 When the Select Operation Is Executed: ERROR 3854 (HY000): Cannot convert string '\xF0\x9F\x98\xA6\xF0\x9F...' from utf8mb4 to latin1 Is Displayed

How to repeat:
For details about tbl_1_all_type2index_desc.sql/tbl_1_all_type2index.sql. see the attachment.

source tbl_1_all_type2index_desc.sql
source tbl_1_all_type2index.sql

select col1, col2, ifnull(col2,col3) as col3, col4, col3+col4 col5,if(strcmp(col1,col2),col1,col2) as col6,case when strcmp(col1,col3) then col1 else col3 end as col7 from (select char_col col1, varbinary_col col2, timestamp_col col3, max(id_col) col4 from (select 1 order by 1) b inner join tbl_1_all_type2index c on 0=1 or c.varbinary_col < c.timestamp_col where 0=0 xor c.timestamp_col is null group by 1,2,3 order by 1,2,3,4) a group by 1,2,3,4,5,6,7 having 0=0 xor col1 in ('aaa2', 'aaaa', 'aabb', 'aacd', 'ab', 'null') order by 1,2,3,4,5,6,7 limit 10;
[9 Jun 13:56] MySQL Verification Team
Hello Alice Alice,

Thank you for the report and feedback.

regards,
Umesh
[10 Jun 10:43] Roy Lyseng
A simple workaround for this problem is to typecast the temporal argument to strcmp() into a character string, e.g

  select col1, col2, if(strcmp(col1,CAST(col2 AS CHAR)),col1,col2) as col6 ...
[24 Jul 12:28] MySQL Verification Team
Bug #118249 marked as duplicate of this one.