Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: Illegal mix of collations for operation ‘UNION’

[Test Environment] TiDB
[TiDB Version] v6.2.0
[Issue] The following SQL reports an error: 1271 - Illegal mix of collations for operation ‘UNION’
select distinct a.ti_jgywlb check_value from tcsjsjg a
union all
select 'TGZX' check_value from dual
[Configuration Information]
- Database server character set: export LANG=“zh_CN.gbk”
- Create database character set: CREATE DATABASE fm CHARACTER SET gbk COLLATE gbk_bin;
- Table character set:
create table tcsjsjg
(
...
) default charset=gbk collate gbk_bin;
What could be the reason for this issue?