pingcap / pingcap/tidb

the substring statement results is different

Open
#37,263 0 comments 0 reactions 1 assignee Claimed by @zanmato1984 View on GitHub
affects-5.0 affects-5.1 affects-5.2 affects-5.3 affects-5.4 affects-6.0 affects-6.1 affects-6.2 affects-6.3 affects-6.4 affects-6.5 affects-6.6 affects-7.0 affects-7.1 affects-7.5 component/tiflash may-affects-4.0 severity/major sig/execution 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)

```
use test;
source [test.txt](https://github.com/pingcap/tidb/files/9391801/test.txt)
alter table IDT_26965 set tiflash replica 1;
select sleep(5);

select /*+ read_from_storage(tikv[IDT_26965]) */ count(*) from IDT_26965 where substring(col1, -3, 1) = '';
select /*+ read_from_storage(tiflash[IDT_26965]) */ count(*) from IDT_26965 where substring(col1, -3, 1) = '';
```

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

### 3. What did you see instead (Required)
```
MySQL [test]> select /*+ read_from_storage(tikv[IDT_26965]) */ count(*) from IDT_26965 where substring(col1, -3, 1) = '';
+----------+
| count(*) |
+----------+
| 102 |
+----------+
1 row in set (0.01 sec)

MySQL [test]> select /*+ read_from_storage(tiflash[IDT_26965]) */ count(*) from IDT_26965 where substring(col1, -3, 1) = '';
+----------+
| count(*) |
+----------+
| 51 |
+----------+
1 row in set (0.02 sec)
```
### 4. What is your TiDB version? (Required)

```
Release Version: v6.3.0-alpha
Edition: Community
Git Commit Hash: 8b5b724d8a932239303a1d0ba547323eb0e5161b
Git Branch: heads/refs/tags/v6.3.0-alpha
UTC Build Time: 2022-08-19 14:31:05
GoVersion: go1.18.5
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.