Memtable equality (ci) vs range (bin) collation split: a row equal to V is not in [V, V]
- 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 = 'TABLES_PRIV'; -- 1
SELECT COUNT(*) FROM information_schema.tables
WHERE TABLE_NAME BETWEEN 'TABLES_PRIV' AND 'TABLES_PRIV'; -- 0 (!)
SELECT COUNT(*) FROM information_schema.tables
WHERE TABLE_NAME = 'TABLES_PRIV' AND TABLE_NAME > 'U'; -- 0
SELECT COUNT(*) FROM information_schema.tables
WHERE TABLE_NAME = 'TABLES_PRIV' AND TABLE_NAME < 'U'; -- 0 (trichotomy!)
SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME = 'tables'; -- 1
SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME <> 'tables'; -- 847 of 847
```
### 2. What did you expect to see? (Required)
equality predicates resolve through CIStr schema-object lookup (case-insensitive) while < / > / BETWEEN evaluate under the declared collation
```
mysql> SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME = 'tables'; -- 1
+----------+
| COUNT(*) |
+----------+
| 0 |
+----------+
1 row in set (0.00 sec)
```
### 3. What did you see instead (Required)
```
mysql> SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME = 'tables'; -- 1
+----------+
| COUNT(*) |
+----------+
| 1 |
+----------+
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
Assessment
This issue has not been assessed yet.