pingcap / pingcap/tidb

Released SELECT statement does not report warning

Open
#39,851 0 comments 0 reactions 0 assignees View on GitHub
severity/moderate sig/planner 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)

```sql
/* init */ CREATE TABLE t (c1 INT, c2 INT);
/* init */ INSERT INTO t VALUES (1, 1);

/* tx1 */ BEGIN;
/* tx2 */ BEGIN;
/* tx1 */ SELECT c1 FROM t WHERE c2 FOR UPDATE;
/* tx2 */ SELECT /*+ INL_JOIN(t)*/c1 FROM t WHERE c2<=c1 FOR UPDATE; -- blocked
/* tx1 */ COMMIT; -- tx2 released
/* tx2 */ COMMIT;
```

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

SELECT statement in tx2 reports warning:
```sql
tidb> SELECT /*+ INL_JOIN(t)*/c1 FROM t WHERE c2<=c1 FOR UPDATE;
Warning[1815] There are no matching table names for (t) in optimizer hint /*+ INL_JOIN(t) */ or /*+ TIDB_INLJ(t) */. Maybe you can use the table alias name

tidb> BEGIN;
tidb> SELECT /*+ INL_JOIN(t)*/c1 FROM t WHERE c2<=c1 FOR UPDATE;
Warning[1815] There are no matching table names for (t) in optimizer hint /*+ INL_JOIN(t) */ or /*+ TIDB_INLJ(t) */. Maybe you can use the table alias name
```

### 3. What did you see instead (Required)

SELECT statement in tx2 does not report warning.

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

```sql
+--------------------+
| version() |
+--------------------+
| 5.7.25-TiDB-v6.4.0 |
+--------------------+
```

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.