Open zhangysh1995 opened 4 years ago
/bug P1
Window functions are a MySQL 8.0 feature. Both these queries actually work in MySQL 8, but the result of the first query is different, which I believe is a bug:
drop table if exists t;
create table t(a int, b int);
insert into t values(1,2),(4,5);
select (select sum(a) over ()) from t ;
select sum(a) over () from t ;
..
mysql [localhost:8020] {msandbox} (test) > select (select sum(a) over ()) from t ;
+-------------------------+
| (select sum(a) over ()) |
+-------------------------+
| 1 |
| 4 |
+-------------------------+
2 rows in set (0.00 sec)
mysql [localhost:8020] {msandbox} (test) > select sum(a) over () from t ;
+----------------+
| sum(a) over () |
+----------------+
| 5 |
| 5 |
+----------------+
2 rows in set (0.00 sec)
Bug Report
1. What did you do?
2. What did you expect to see?
3. What did you see instead?
The results don't make any sense.
4. What version of TiDB are you using? (
tidb-server -V
or runselect tidb_version();
on TiDB)Reproducible on master branch: