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
2a361ebe
Commit
2a361ebe
authored
Mar 17, 2018
by
zhzhzoo
Committed by
Vicențiu Ciorbaru
Aug 25, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-15204: lag/lead function order list mandatory
parent
c826b6b8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
4 deletions
+30
-4
mysql-test/r/win.result
mysql-test/r/win.result
+2
-2
mysql-test/r/win_lead_lag.result
mysql-test/r/win_lead_lag.result
+11
-0
mysql-test/t/win.test
mysql-test/t/win.test
+2
-2
mysql-test/t/win_lead_lag.test
mysql-test/t/win_lead_lag.test
+13
-0
sql/item_windowfunc.h
sql/item_windowfunc.h
+2
-0
No files found.
mysql-test/r/win.result
View file @
2a361ebe
...
...
@@ -3219,8 +3219,8 @@ DROP TABLE fv_test, fv_result;
#
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (0),(1),(2);
SELECT LEAD(a) OVER (PARTITION BY a) as lead,
a AND LEAD(a) OVER (PARTITION BY a) AS a_and_lead_part
SELECT LEAD(a) OVER (PARTITION BY a
ORDER BY a
) as lead,
a AND LEAD(a) OVER (PARTITION BY a
ORDER BY a
) AS a_and_lead_part
FROM t1;
lead a_and_lead_part
NULL 0
...
...
mysql-test/r/win_lead_lag.result
View file @
2a361ebe
...
...
@@ -226,4 +226,15 @@ pk a b a+b lag(a + b) over (partition by a order by pk) + pk
9 2 2 4 12
10 2 0 2 14
11 2 10 12 13
#
# MDEV-15204 - LAG function doesn't require ORDER BY in OVER clause
#
select pk,
lag(pk, 1) over ()
from t1;
ERROR HY000: No order list in window specification for 'lag'
select pk,
lead(pk, 1) over ()
from t1;
ERROR HY000: No order list in window specification for 'lead'
drop table t1;
mysql-test/t/win.test
View file @
2a361ebe
...
...
@@ -2000,8 +2000,8 @@ DROP TABLE fv_test, fv_result;
CREATE
TABLE
t1
(
a
int
);
INSERT
INTO
t1
VALUES
(
0
),(
1
),(
2
);
SELECT
LEAD
(
a
)
OVER
(
PARTITION
BY
a
)
as
lead
,
a
AND
LEAD
(
a
)
OVER
(
PARTITION
BY
a
)
AS
a_and_lead_part
SELECT
LEAD
(
a
)
OVER
(
PARTITION
BY
a
ORDER
BY
a
)
as
lead
,
a
AND
LEAD
(
a
)
OVER
(
PARTITION
BY
a
ORDER
BY
a
)
AS
a_and_lead_part
FROM
t1
;
SELECT
a
OR
LEAD
(
a
)
OVER
(
ORDER
BY
a
)
AS
a_or_lead_order
...
...
mysql-test/t/win_lead_lag.test
View file @
2a361ebe
...
...
@@ -107,4 +107,17 @@ select pk, a, b, a+b,
from
t1
order
by
pk
asc
;
--
echo
#
--
echo
# MDEV-15204 - LAG function doesn't require ORDER BY in OVER clause
--
echo
#
--
error
ER_NO_ORDER_LIST_IN_WINDOW_SPEC
select
pk
,
lag
(
pk
,
1
)
over
()
from
t1
;
--
error
ER_NO_ORDER_LIST_IN_WINDOW_SPEC
select
pk
,
lead
(
pk
,
1
)
over
()
from
t1
;
drop
table
t1
;
sql/item_windowfunc.h
View file @
2a361ebe
...
...
@@ -792,6 +792,8 @@ class Item_window_func : public Item_func_or_sum
case
Item_sum
:
:
DENSE_RANK_FUNC
:
case
Item_sum
:
:
PERCENT_RANK_FUNC
:
case
Item_sum
:
:
CUME_DIST_FUNC
:
case
Item_sum
:
:
LAG_FUNC
:
case
Item_sum
:
:
LEAD_FUNC
:
return
true
;
default:
return
false
;
...
...
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