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

select var_pop(distinct xxx) could successfully execute in TiDB but failed in MySQL #19499

Open
Win-Man opened this issue Aug 26, 2020 · 9 comments
Labels
challenge-program good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. sig/execution SIG execution type/compatibility

Comments

@Win-Man
Copy link
Contributor

Win-Man commented Aug 26, 2020

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  • TiDB
mysql> create table t1 (grp int, a bigint unsigned, c char(10) not null);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into t1 values (1,1,"a");
Query OK, 1 row affected (0.01 sec)

mysql> select var_pop(distinct grp) from t1;
+-----------------------+
| var_pop(distinct grp) |
+-----------------------+
|                     0 |
+-----------------------+
1 row in set (0.00 sec)
  • MySQL -8.0.19
[email protected] : gangshen 02:25:53> create table t1 (grp int, a bigint unsigned, c char(10) not null);
Query OK, 0 rows affected (0.02 sec)

[email protected] : gangshen 02:25:57>  insert into t1 values (1,1,"a");
Query OK, 1 row affected (0.00 sec)

[email protected] : gangshen 02:26:01> select var_pop(distinct grp) from t1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'distinct grp) from t1' at line 1
  • MySQL 5.7.31:
mysql [localhost:5731] {msandbox} ((none)) > select var_pop(distinct grp) from t1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'distinct grp) from t1' at line 1

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

select var_pop(distinct xxx) failed.
I‘ve refered MySQL docs: link
It seems var_pop/stdev func couldn't contains distinct in it.

3. What did you see instead (Required)

It could execute successfully.

4. What is your TiDB version? (Required)

  • nightly

SIG slack channel

#sig-exec

Score

  • 300

Mentor

@Win-Man Win-Man added the type/bug The issue is confirmed as a bug. label Aug 26, 2020
@time-and-fate
Copy link
Member

/label sig/execution

@ti-srebot ti-srebot added the sig/execution SIG execution label Aug 27, 2020
@SunRunAway SunRunAway added type/compatibility and removed type/bug The issue is confirmed as a bug. labels Nov 3, 2020
@hidehalo
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@ti-challenge-bot
Copy link

@hidehalo You did not submit PR within 7 days, so give up automatically.

@ti-challenge-bot ti-challenge-bot bot removed the picked label Dec 7, 2020
@hidehalo
Copy link
Contributor

hidehalo commented Dec 7, 2020

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@dyzsr
Copy link
Contributor

dyzsr commented Dec 9, 2020

Postgres also support std/var_pop/var_samp(distinct), do we really have to disable it? @XuHuaiyu

@kennytm
Copy link
Contributor

kennytm commented Dec 10, 2020

(for those not following, please check the discussion in pingcap/parser#1116.)

@ti-challenge-bot
Copy link

@hidehalo You did not submit PR within 7 days, so give up automatically.

@ti-challenge-bot ti-challenge-bot bot removed the picked label Dec 14, 2020
@tisonkun tisonkun added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. and removed difficulty/easy labels Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
challenge-program good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. sig/execution SIG execution type/compatibility
Projects
None yet
8 participants