pingcap / pingcap/tidb

Set non-exists partition for `PointGet` plan will not get error

Open
#59,003 0 comments 0 reactions 1 assignee Claimed by @mjonss View on GitHub
component/tablepartition severity/moderate sig/sql-infra 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
CREATE TABLE `t1` (
`a` int DEFAULT NULL,
`b` int DEFAULT NULL,
UNIQUE KEY `idx2` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
PARTITION BY HASH (`a`) PARTITIONS 5;
select * from t1 partition(p2000) where a = 1;
```

### 2. What did you expect to see? (Required)
Like other plans, report error

```sql
mysql> select * from t1 partition(p2000);
ERROR 1735 (HY000): Unknown partition 'p2000' in table 't1'
```

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

Get empty result

```
mysql> select * from t1 partition(p2000) where a = 1;
Empty set (0.00 sec)
```

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

```
mysql> SELECT tidb_version();
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v9.0.0-alpha-117-g5e9748c040
Edition: Community
Git Commit Hash: 5e9748c0403e9d01f2bee993e4a4240711f52300
Git Branch: HEAD
UTC Build Time: 2025-01-16 03:38:57
GoVersion: go1.23.4
Race Enabled: false
Check Table Before Drop: false
Store: tikv |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
```

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.