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

P1-[4.0 bug hunting]-[Aggregate Fcuntion]-group_concat incompatible with MySQL #17748

Closed
sre-bot opened this issue Jun 5, 2020 · 3 comments · Fixed by #21431
Closed

P1-[4.0 bug hunting]-[Aggregate Fcuntion]-group_concat incompatible with MySQL #17748

sre-bot opened this issue Jun 5, 2020 · 3 comments · Fixed by #21431
Assignees
Labels
severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@sre-bot
Copy link
Contributor

sre-bot commented Jun 5, 2020

Bug Hunter issue tidb-challenge-program/bug-hunting-issue#78


Bug Report

1. What did you do?

drop table if exists t1, t2;

create table t1 (a int, b int);
create table t2 (m int, n int);
insert into t1 values (2,2), (2,2), (3,3), (3,3), (3,3), (4,4);
insert into t2 values (1,11), (2,22), (3,32), (4,44), (4,44);
set @@sql_mode='TRADITIONAL';

select count(*) c, a,
 ( select group_concat(count(a)) from t2 where m = a )
 from t1 group by a;

2. What did you expect to see?

mysql> select count(*) c, a,
    ->  ( select group_concat(count(a)) from t2 where m = a )
    ->  from t1 group by a;
+---+------+-------------------------------------------------------+
| c | a    | ( select group_concat(count(a)) from t2 where m = a ) |
+---+------+-------------------------------------------------------+
| 2 |    2 | 2                                                     |
| 3 |    3 | 3                                                     |
| 1 |    4 | 1,1                                                   |
+---+------+-------------------------------------------------------+
3 rows in set (0.00 sec)

3. What did you see instead?

mysql> select count(*) c, a,
    ->  ( select group_concat(count(a)) from t2 where m = a )
    ->  from t1 group by a;
ERROR 1111 (HY000): Invalid use of group function

4. What version of TiDB are you using? (tidb-server -V or run select tidb_version(); on TiDB)

+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                           |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: None
Edition: None
Git Commit Hash: None
Git Branch: None
UTC Build Time: None
GoVersion: go1.13.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Reproducible on master branch:

commit 2efab88a59499ea3934c8c1eba7b695cf24b9d29 (HEAD -> master, origin/master, origin/HEAD)
Author: Wenxuan <hi@breeswish.org>
Date:   Fri May 15 21:53:32 2020 +0800
@sre-bot sre-bot added the type/bug The issue is confirmed as a bug. label Jun 5, 2020
@djshow832 djshow832 added the sig/execution SIG execution label Jun 5, 2020
@zz-jason zz-jason added sig/planner SIG: Planner and removed sig/execution SIG execution labels Jun 7, 2020
@dyzsr
Copy link
Contributor

dyzsr commented Oct 28, 2020

/assign

@dyzsr dyzsr removed their assignment Nov 2, 2020
@lzmhhh123 lzmhhh123 assigned lzmhhh123 and unassigned lzmhhh123 Nov 4, 2020
@dyzsr
Copy link
Contributor

dyzsr commented Nov 10, 2020

/assign

@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate 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