Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL)
Description
This works:
MariaDB [test]> SELECT sum(salary) OVER (PARTITION BY salary ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM employee_salary; |
+-----------------------------------------------------------------------------------------+ |
| sum(salary) OVER (PARTITION BY salary ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) | |
+-----------------------------------------------------------------------------------------+ |
| 5000 |
|
| 10000 |
|
| 20000 |
|
| 30000 |
|
| 80000 |
|
| 40000 |
|
| 150000 |
|
| 100000 |
|
| 50000 |
|
+-----------------------------------------------------------------------------------------+ |
9 rows in set (0.00 sec) |
But this does not work and returns a rather vague syntax error:
SELECT sum(salary) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM employee_salary; |
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM employee_salary' at line 1 |
It works in PostgreSQL:
postgres=# SELECT sum(salary) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM employee_salary; |
sum |
--------
|
295000
|
285000
|
265000
|
235000
|
195000
|
155000
|
105000
|
55000
|
5000
|
(9 rows) |
Standard specifies:
<window specification> ::=
|
<left paren> <window specification details> <right paren>
|
<window specification details> ::=
|
[ <existing window name> ]
|
[ <window partition clause> ]
|
[ <window order clause> ]
|
[ <window frame clause> ]
|
<existing window name> ::=
|
<window name>
|