现象
MySQL 8.0.32 下使用含中文的字段作为模糊过滤条件,查找不到数据。样例SQL如下:
select * from (
select *
from test_1
union
select *
from test_1
) temp
where name like '%姜志福%'
测试数据:
临时解决方案
使用hints关闭派生条件下推:
select /*+ NO_DERIVED_CONDITION_PUSHDOWN(temp) */ * from (
select *
from test_1
union
select *
from test_1
) temp
where name like '%姜志福%'
参考链接
https://dev.mysql.com/doc/refman/8.0/en/optimizer-hints.html