pingcap / pingcap/tidb

Unknown column '0' in 'group statement'

Open
#65,939 2 comments 0 reactions 0 assignees View on GitHub
contribution severity/major 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)

```
CREATE TABLE v0 ( v1 INTEGER, v2 INTEGER, v3 INTEGER );
INSERT INTO v0 VALUES ( 50, 8, 0 );
INSERT INTO v0 VALUES ( -1, 41, 0 );
SELECT ( SELECT -1 FROM v0 GROUP BY FALSE, ( v2 ^ v2 ) > v2 ), 16;
```

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

results from mysql:
```
mysql> CREATE TABLE v0 ( v1 INTEGER, v2 INTEGER, v3 INTEGER );
Query OK, 0 rows affected (0.07 sec)

mysql> INSERT INTO v0 VALUES ( 50, 8, 0 );
Query OK, 1 row affected (0.02 sec)

mysql> INSERT INTO v0 VALUES ( -1, 41, 0 );
Query OK, 1 row affected (0.02 sec)

mysql> SELECT ( SELECT -1 FROM v0 GROUP BY FALSE, ( v2 ^ v2 ) > v2 ), 16;
+--------------------------------------------------------+----+
| ( SELECT -1 FROM v0 GROUP BY FALSE, ( v2 ^ v2 ) > v2 ) | 16 |
+--------------------------------------------------------+----+
| -1 | 16 |
+--------------------------------------------------------+----+
1 row in set (0.00 sec)
```
### 3. What did you see instead (Required)

results from tidb:
```
mysql> CREATE TABLE v0 ( v1 INTEGER, v2 INTEGER, v3 INTEGER );
Query OK, 0 rows affected (0.05 sec)

mysql> INSERT INTO v0 VALUES ( 50, 8, 0 );
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO v0 VALUES ( -1, 41, 0 );
Query OK, 1 row affected (0.00 sec)

mysql> SELECT ( SELECT -1 FROM v0 GROUP BY FALSE, ( v2 ^ v2 ) > v2 ), 16;
ERROR 1105 (HY000): Unknown column '0' in 'group statement'
```

### 4. What is your TiDB version? (Required)
|
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v8.4.0-this-is-a-placeholder
Edition: Community
Git Commit Hash: None
Git Branch: None
UTC Build Time: None
GoVersion: go1.25.6
Race Enabled: false
Check Table Before Drop: false
Store: unistore
Kernel Type: Classic |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 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.