0
点赞
收藏
分享

微信扫一扫

mysql 8.0.32 视图中文无法过滤

mysql8.0.32 视图中 采用union all 或union合并获取结果时, 含有中文的字段过滤失效

会提示 类似如下的信息

Warning | 1300 | Cannot convert string '\xE5\xAE\xA2\xE6\x88\xB7...' from utf8mb4 to binary

这是此版本bug. 在对派生表使用where条件时,如果对应值超过128(ascii值),对应字符转化就会失效,索引查询不到数据. 

bugfix说明如下:

When cloning a condition to push down to a derived table,
    characters in strings representing conditions were converted to
    utfmb4 correctly only for values less than 128 (the ASCII
    subset), and code points outside the ASCII subset were converted
    to invalid characters, causing the resulting character strings
    to become invalid. For derived tables without UNIONS, this led
    to problems when a column name from the derived table used
    characters outside the ASCII subset, and was used in the WHERE
    condition. For derived tables with UNIONS it created problems
    when a character outside the ASCII subset was present in a WHERE
    condition.

    We fix these issues by initializing the string used in such
    cases for representing the condition to the connection character
    set.

修正方法:

设定 优化规则 optimizer_switch 其中 derived_condition_pushdown 修改为off

mysql 8.0.32 视图中文无法过滤_optimizer_switch



举报

相关推荐

0 条评论