pingcap / pingcap/tidb

'select from values' returns error:Unknown table ''

Open
#61,514 0 comments 0 reactions 0 assignees View on GitHub
compatibility-mysql8 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)
```
select * from (values row(1),row(2)) a;
```

### 2. What did you expect to see? (Required)
results from mysql:
```
MySQL [fuzztest]> select * from (values row(1),row(2)) a
-> ;
+----------+
| column_0 |
+----------+
| 1 |
| 2 |
+----------+
2 rows in set (0.00 sec)

```

### 3. What did you see instead (Required)
```
MySQL [test1]> select * from (values row(1),row(2)) a
-> ;
ERROR 1051 (42S02): Unknown table ''
```

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

```
MySQL [test1]> select tidb_version();
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v7.5.6
Edition: Community
Git Commit Hash: 1ad553d6de2cb0c9b2f3cfdb760aaae109b2c466
Git Branch: HEAD
UTC Build Time: 2025-03-12 10:49:51
GoVersion: go1.21.13
Race Enabled: false
Check Table Before Drop: false
Store: tikv |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.07 sec)
```

Contributor guide

Open the contributing guide

Research direction

Start by running the reported SELECT query on TiDB v7.5.6 and compare its behavior with the MySQL result shown in the issue. Trace the handling of a VALUES expression used as a derived table, then verify that the query returns two rows without the Unknown table error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.