Bug #104633 Grammar mistakes
Submitted: 16 Aug 2021 6:15 Modified: 16 Aug 2021 12:03
Reporter: linfeng chen Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.0.21 OS:Any
Assigned to: CPU Architecture:Any
Tags: grammar

[16 Aug 2021 6:15] linfeng chen
Description:
create table t3(f1 int, f2 int);
insert into t3 values(1,1);
insert into t3 values(2,2);
select distinct f1 ,avg(f2) from t3;
+------+---------+
| f1   | avg(f2) |
+------+---------+
|    1 |  1.5000 |
+------+---------+

How to repeat:
create table t3(f1 int, f2 int);
insert into t3 values(1,1);
insert into t3 values(2,2);
select distinct f1 ,avg(f2) from t3;
+------+---------+
| f1   | avg(f2) |
+------+---------+
|    1 |  1.5000 |
+------+---------+

Suggested fix:
Error message:column "t3.f1" must appear in the group by clause or be used in an aggregate function.
[16 Aug 2021 12:03] MySQL Verification Team
Hi Mr. chen,

Thank you for your bug report.

However, you are using and old release and you have (probably) not set your configuration accordingly.

Simply, your test case returns a proper error message:

"
ERROR 1140 (42000) at line 6: In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'test.t1.f1'; this is incompatible with sql_mode=only_full_group_by
"

NOT a bug.