pingcap / pingcap/tidb

Doesn't support `GROUP BY` with column that has a `BINARY` qualifier

Open
#49,658 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)

In the phpmyadmin intferace, when I click the **New** button, it execute a `SELECT` query, but failed.

```sql
SELECT
BINARY s.SCHEMA_NAME AS BIN_NAME,
s.DEFAULT_COLLATION_NAME
FROM `information_schema`.SCHEMATA s
GROUP BY s.SCHEMA_NAME, s.DEFAULT_COLLATION_NAME
ORDER BY BINARY `SCHEMA_NAME` ASC
```

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

No error.

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

It seems that TiDB doesn't support `GROUP BY` with column that has a `BINARY` qualifier.

The user of phpmyadmin will get an error as follows:

![image](https://github.com/pingcap/tidb/assets/5086433/9af6b07a-28ad-4884-a605-3294614f5262)

Error message:

```
#1055 - Expression #1 of ORDER BY is not in GROUP BY clause and contains nonaggregated column '' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
```

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

```
mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v7.6.0-alpha
Edition: Community
Git Commit Hash: 7d33d0d226ea69ef49fb0a6786f8972e112adf4b
Git Branch: heads/refs/tags/v7.6.0-alpha
UTC Build Time: 2023-12-19 14:25:20
GoVersion: go1.21.5
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.