The query results of the LIKE operation are incorrect in TiDB version 5.4

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb5.4版本like查询数据结果不对

| username: luqiuhua

TiDB version 5.4.0 / 5.4.2

SQL query using LIKE with one character ‘阿%’ returns no results, but using LIKE with two characters ‘阿莫%’ displays results normally.

[Image]
Image [Image]

| username: luqiuhua | Original post link

Is this a bug?

| username: Billmay表妹 | Original post link

Does it mean that the result from 5.4.0 is correct, and the result from 5.4.2 is incorrect?

| username: luqiuhua | Original post link

No, it’s not. None of the 5.4.X versions are working properly.

| username: luqiuhua | Original post link

To add, I tried searching with ‘阿%’ and ‘阿莫%’ and the former also couldn’t retrieve results.

| username: 啦啦啦啦啦 | Original post link

See if the situation is similar to this post.

| username: ShawnYan | Original post link

Could you show the table structure definition (including collation)?

| username: TiDBer_wTKU9jv6 | Original post link

Version 6.1 tested successfully

| username: songxuecheng | Original post link

  1. show create table xxx; Please share the table structure.
  2. show global variables like ‘%coll%’; Please check.
| username: cs58_dba | Original post link

In version 5.7.25-TiDB-v5.4.0, setting the table character set to utf8 and collation to utf8_general_ci did not result in any anomalies.

| username: ealam_小羽 | Original post link

It is most likely due to character set issues. You can check out this document:

| username: xiaohetao | Original post link

:+1::+1::+1:

| username: cs58_dba | Original post link

Tested in version 5.4.0, it is indeed the case. Marking it down.

| username: system | Original post link

This topic was automatically closed 1 minute after the last reply. No new replies are allowed.