1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

Window functions: handle window functions as arguments to other functions

Window functions need to have their own column in the work (temp) table,
like aggregate functions do.
They don't need val_int() -> val_int_result() conversion though, so they
should be wrapped with Item_direct_ref, not Item_aggregate_ref.
This commit is contained in:
Sergei Petrunia
2016-04-10 10:13:55 +02:00
parent 91fc90c372
commit 29705a4d38
4 changed files with 63 additions and 8 deletions

View File

@@ -1812,3 +1812,22 @@ s1 s2 X
NULL a 2
NULL NULL 1
drop table t1;
#
# Try window functions that are not directly present in the select list
#
create table t1 (a int, b int);
insert into t1 values
(1,3),
(2,2),
(3,1);
select
rank() over (order by a) -
rank() over (order by b)
from
t1;
rank() over (order by a) -
rank() over (order by b)
0
0
0
drop table t1;