Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5
-
None
Description
create table t1 (a int, b varchar(5)); |
insert into t1 values (1,'a'), (2, 'b'), (3, 'c'); |
 |
select sum(a) over (order by b range between unbounded preceding and current row) from t1; |
MariaDB [test]> select sum(a) over (order by b range between unbounded preceding and current row) from t1;
|
ERROR 4021 (HY000): Numeric datatype is required for RANGE-type frame
|
Mysql/Postgres return:
mysql> select sum(a) over (order by b range between unbounded preceding and current row) from t1;
|
+----------------------------------------------------------------------------+
|
| sum(a) over (order by b range between unbounded preceding and current row) |
|
+----------------------------------------------------------------------------+
|
| 1 |
|
| 3 |
|
| 6 |
|
+----------------------------------------------------------------------------+
|
3 rows in set (0.00 sec)
|
Also range-type frame always expects ORDER BY clause:
MariaDB [test]> select sum(a) over (range between unbounded preceding and current row) from t1;
|
ERROR 4019 (HY000): RANGE-type frame requires ORDER BY clause with single sort key
|
Mysql 8.0.15:
mysql> select sum(a) over (range between unbounded preceding and current row) from t1;
|
+-----------------------------------------------------------------+
|
| sum(a) over (range between unbounded preceding and current row) |
|
+-----------------------------------------------------------------+
|
| 6 |
|
| 6 |
|
| 6 |
|
+-----------------------------------------------------------------+
|
3 rows in set (0.00 sec)
|
Attachments
Issue Links
- relates to
-
MDEV-9740 Window functions: catch invalid window frame specs
- Closed