Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The SQL statement that broke the limit of ‘only_full_gropy_by’ did not trigger the error normally #27539

Closed
rebelice opened this issue Aug 24, 2021 · 4 comments · Fixed by #33567
Labels
feature/developing the related feature is in development severity/minor sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@rebelice
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t(a int, b int, c int);
select @@sql_mode; /* check SQL mode */
select case when a=1 then max(b) end as max_b from (select * from t union all select * from t) x group by c;

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

ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'x.a' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

3. What did you see instead (Required)

no error

4. What is your TiDB version? (Required)

MySQL [test]> select tidb_version();
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v5.2.0-alpha-720-gd9bf3bf2d
Edition: Community
Git Commit Hash: d9bf3bf
Git Branch: HEAD
UTC Build Time: 2021-08-24 06:11:04
GoVersion: go1.16.6
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.001 sec)

@rebelice rebelice added the type/bug The issue is confirmed as a bug. label Aug 24, 2021
@tiancaiamao

This comment has been minimized.

@kennytm

This comment has been minimized.

@tiancaiamao
Copy link
Contributor

@kennytm OK, maybe I'm wrong ... or maybe I'm using some other wrong version ...
Now that I can't reproduce it neither, let's ignore it.

@AilinKid
Copy link
Contributor

FD in logical union hasn't been considered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/developing the related feature is in development severity/minor sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants