pingcap / pingcap/tidb

Memtable LIKE extractor hardcodes case-insensitivity: P AND NOT P returns 546 rows

Open
#70,825 3 comments 0 reactions 0 assignees View on GitHub
affects-25.10 affects-26.3 affects-8.5 contribution severity/critical sig/sql-infra type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

```
SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME LIKE 'T%'; -- 569 (ci)
SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME NOT LIKE 'T%'; -- 824 (bin)
SELECT COUNT(*) FROM information_schema.tables
WHERE TABLE_NAME LIKE 'T%' AND TABLE_NAME NOT LIKE 'T%'; -- 546 (!)

```

### 2. What did you expect to see? (Required)
```
mysql> SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME LIKE 'T%'; -- 569 (ci)
+----------+
| COUNT(*) |
+----------+
| 7 |
+----------+
1 row in set (0.00 sec)

mysql> SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME NOT LIKE 'T%'; -- 824 (bin)
+----------+
| COUNT(*) |
+----------+
| 422 |
+----------+
1 row in set (0.00 sec)

mysql> SELECT COUNT(*) FROM information_schema.tables
-> WHERE TABLE_NAME LIKE 'T%' AND TABLE_NAME NOT LIKE 'T%'; -- 546 (!)
+----------+
| COUNT(*) |
+----------+
| 0 |
+----------+
1 row in set (0.01 sec)
```
### 3. What did you see instead (Required)
```

mysql> SELECT COUNT(*) FROM information_schema.tables
-> WHERE TABLE_NAME LIKE 'T%' AND TABLE_NAME NOT LIKE 'T%'; -- 546 (!)
+----------+
| COUNT(*) |
+----------+
| 547 |
+----------+
1 row in set (0.00 sec)
```

### 4. What is your TiDB version? (Required)

```
mysql> select tidb_version();
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v9.0.0-beta.2.pre-2174-g65ac2fad58-dirty
Edition: Community
Git Commit Hash: 65ac2fad582510b92d3c4b79999e48217c989737
Git Branch: master
UTC Build Time: 2026-08-30 15:18:00
GoVersion: go1.25.12
Race Enabled: false
Check Table Before Drop: false
Store: unistore
Kernel Type: Classic |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the three information_schema.tables queries and compare the LIKE and NOT LIKE counts. Then trace the memtable LIKE extractor named in the report; done means LIKE and NOT LIKE use compatible case semantics so their conjunction returns 0 rows, matching the expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.