Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
72a4969e
Commit
72a4969e
authored
Mar 16, 2016
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add testcases for frames with bound1 > bound2.
parent
5eee8bbe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
0 deletions
+92
-0
mysql-test/r/win.result
mysql-test/r/win.result
+59
-0
mysql-test/t/win.test
mysql-test/t/win.test
+33
-0
No files found.
mysql-test/r/win.result
View file @
72a4969e
...
...
@@ -1118,3 +1118,62 @@ pk a CNT
7 13 4
8 14 3
drop table t1;
#
# Try ranges that have bound1 > bound2. The standard actually allows them
#
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (pk int, c int);
insert into t1 select a+1,1 from t0;
update t1 set c=2 where pk not in (1,2,3,4);
select * from t1;
pk c
1 1
2 1
3 1
4 1
5 2
6 2
7 2
8 2
9 2
10 2
select
pk, c,
count(*) over (partition by c
order by pk
rows between 1 preceding
and 2 preceding)
as cnt
from t1;
pk c cnt
1 1 0
2 1 0
3 1 0
4 1 0
5 2 0
6 2 0
7 2 0
8 2 0
9 2 0
10 2 0
select
pk, c,
count(*) over (partition by c
order by pk
range between 1 preceding
and 2 preceding)
as cnt
from t1;
pk c cnt
1 1 0
2 1 0
3 1 0
4 1 0
5 2 0
6 2 0
7 2 0
8 2 0
9 2 0
10 2 0
drop table t0, t1;
mysql-test/t/win.test
View file @
72a4969e
...
...
@@ -664,3 +664,36 @@ select
and
2
following
)
as
CNT
from
t1
;
drop
table
t1
;
--
echo
#
--
echo
# Try ranges that have bound1 > bound2. The standard actually allows them
--
echo
#
create
table
t0
(
a
int
);
insert
into
t0
values
(
0
),(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
),(
9
);
create
table
t1
(
pk
int
,
c
int
);
insert
into
t1
select
a
+
1
,
1
from
t0
;
update
t1
set
c
=
2
where
pk
not
in
(
1
,
2
,
3
,
4
);
select
*
from
t1
;
select
pk
,
c
,
count
(
*
)
over
(
partition
by
c
order
by
pk
rows
between
1
preceding
and
2
preceding
)
as
cnt
from
t1
;
select
pk
,
c
,
count
(
*
)
over
(
partition
by
c
order
by
pk
range
between
1
preceding
and
2
preceding
)
as
cnt
from
t1
;
drop
table
t0
,
t1
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment