pingcap / pingcap/tidb

The hint for the insert statement can not take effect

Open
#40,059 0 comments 0 reactions 0 assignees View on GitHub
severity/minor 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)
ref https://github.com/pingcap/tidb/issues/16929
Note: the user doc says we haven't support the hint for the insert statement, so we can treat it as a feature. By the way, for the `insert into select` statement, we can write the hint behind the select statement, so the hint can take effect.
```
create table t(a int, b int);
prepare stmt from "insert /*+ ignore_plan_cache() */ into t values(1, 1), (2, 2)";
show warnings;
```

### 2. What did you expect to see? (Required)
After execute the `show warnings;`, we can see the warning message
```
mysql> show warnings;
+---------+------+--------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------+
| Warning | 1105 | skip plan-cache: ignore plan cache by hint |
+---------+------+--------------------------------------------+
1 row in set (0.00 sec)
```

### 3. What did you see instead (Required)
No warning message, the statement can still be cached.

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

latest master

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.