Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

miss record when where condition use right % #35366

Closed
zwathz opened this issue Jun 14, 2022 · 3 comments
Closed

miss record when where condition use right % #35366

zwathz opened this issue Jun 14, 2022 · 3 comments
Assignees
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. duplicate Issues or pull requests already exists. severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@zwathz
Copy link

zwathz commented Jun 14, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

-- table info
CREATE TABLE cp_info (
id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
name varchar(32) COLLATE utf8_general_ci DEFAULT NULL,
PRIMARY KEY (id) /*T![clustered_index] CLUSTERED */,
KEY idx_name (name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci AUTO_INCREMENT=1374818

MySQL [cp_center]> explain select * from cp_center.cp_info where name like '秦文政%';
+-------------+---------+------+---------------+---------------+
| id | estRows | task | access object | operator info |
+-------------+---------+------+---------------+---------------+
| TableDual_5 | 0.00 | root | | rows:0 |
+-------------+---------+------+---------------+---------------+
1 row in set (0.00 sec)

-- after drop name index
MySQL [cp_center]> select id, name from cp_center.cp_info where name like '秦文政%'\G
*************************** 1. row ***************************
id: 1310871
name: 秦文政

2. What did you expect to see? (Required)

MySQL [cp_center]> select id, name from cp_center.cp_info where name = '秦文政'\G
*************************** 1. row ***************************
id: 1310871
name: 秦文政

3. What did you see instead (Required)

MySQL [cp_center]> select id, name from cp_center.cp_info where name like '秦文政%'\G
Empty set (0.00 sec)

4. What is your TiDB version? (Required)

Release Version: v5.4.1
Edition: Community
Git Commit Hash: be48447
Git Branch: heads/refs/tags/v5.4.1
UTC Build Time: 2022-05-07 04:31:32
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

@zwathz zwathz added the type/bug The issue is confirmed as a bug. label Jun 14, 2022
@zwathz
Copy link
Author

zwathz commented Jun 14, 2022

*_general_ci collate cause the problem

@aytrack aytrack added sig/planner SIG: Planner severity/major affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. labels Jun 14, 2022
@aioas
Copy link

aioas commented Jun 17, 2022

We have the same problem. Is there any plan to fix it?

@chrysan chrysan added sig/sql-infra SIG: SQL Infra and removed sig/planner SIG: Planner labels Jun 21, 2022
@wjhuang2016
Copy link
Member

The same as #31174 , fixed by #31278, version: 6.0.0

@wjhuang2016 wjhuang2016 added the duplicate Issues or pull requests already exists. label Jun 21, 2022
@bb7133 bb7133 closed this as completed Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. duplicate Issues or pull requests already exists. severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

7 participants