pingcap / pingcap/tidb

unexpected result caused by LIKE operator and inner join

Open
#61,070 2 comments 0 reactions 0 assignees View on GitHub
severity/moderate sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

The query `SELECT t0.c0, t1.c0 FROM t0 INNER JOIN t1 ON t0.c0 LIKE BINARY t0.c0;` should return nothing. Howerver, it returned 2 rows.

### 1. Minimal reproduce step (Required)

```
CREATE TABLE t0(c0 BOOL);
CREATE TABLE t1 LIKE t0;
INSERT INTO t0 VALUES (false), (true);
INSERT IGNORE INTO t1(c0) VALUES (true);

SELECT t0.c0 LIKE BINARY t0.c0 from t0;
+-------------------------+
| t0.c0 LIKE BINARY t0.c0 |
+-------------------------+
| 0 |
| 0 |
+-------------------------+
2 rows in set (0.00 sec)

SELECT t0.c0, t1.c0 FROM t0 INNER JOIN t1 ON t0.c0 LIKE BINARY t0.c0;
+------+------+
| c0 | c0 |
+------+------+
| 0 | 1 |
| 1 | 1 |
+------+------+
2 rows in set (0.00 sec)
```

### 2. What is your TiDB version? (Required)
v8.5.1

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.