Commit 6681a499 authored by Igor Babaev's avatar Igor Babaev

Post-review addition to the fix for mdev-10868.

parent 061d2820
......@@ -2348,5 +2348,37 @@ pk c CNT
8 2 0.5000
9 2 0.4000
10 2 0.3333
drop view v1,v2,v3;
select pk, c, c/count(*) over (partition by c order by pk
range between 3 preceding and current row) as CNT
from t1;
pk c CNT
1 1 1.0000
2 1 0.5000
3 1 0.3333
4 1 0.2500
5 2 2.0000
6 2 1.0000
7 2 0.6667
8 2 0.5000
9 2 0.5000
10 2 0.5000
create view v4 as select pk, c, c/count(*) over (partition by c order by pk
range between 3 preceding and current row) as CNT
from t1;
show create view v4;
View Create View character_set_client collation_connection
v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,(`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` range between 3 preceding and current row )) AS `CNT` from `t1` latin1 latin1_swedish_ci
select * from v4;
pk c CNT
1 1 1.0000
2 1 0.5000
3 1 0.3333
4 1 0.2500
5 2 2.0000
6 2 1.0000
7 2 0.6667
8 2 0.5000
9 2 0.5000
10 2 0.5000
drop view v1,v2,v3,v4;
drop table t0,t1;
......@@ -1414,5 +1414,15 @@ eval create view v3 as $q;
show create view v3;
select * from v3;
drop view v1,v2,v3;
let $q=
select pk, c, c/count(*) over (partition by c order by pk
range between 3 preceding and current row) as CNT
from t1;
eval $q;
eval create view v4 as $q;
show create view v4;
select * from v4;
drop view v1,v2,v3,v4;
drop table t0,t1;
......@@ -107,7 +107,11 @@ Window_frame::print(String *str, enum_query_type query_type)
case UNITS_ROWS:
str->append(STRING_WITH_LEN(" rows "));
break;
case UNITS_RANGE: str->append(STRING_WITH_LEN(" range "));
case UNITS_RANGE:
str->append(STRING_WITH_LEN(" range "));
break;
default:
DBUG_ASSERT(0);
}
str->append(STRING_WITH_LEN("between "));
......@@ -129,6 +133,7 @@ Window_frame::print(String *str, enum_query_type query_type)
str->append(STRING_WITH_LEN(" ties "));
break;
default:
DBUG_ASSERT(0);
;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment