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
28641640
Commit
28641640
authored
Jun 01, 2016
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-10101 Wrong error message of SELECT 1 UNION (SELECT 1 FROM t1 GROUP BY 1 WITH ROLLUP)
parent
caee832d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
17 deletions
+97
-17
mysql-test/r/parser.result
mysql-test/r/parser.result
+70
-5
mysql-test/t/parser.test
mysql-test/t/parser.test
+27
-5
sql/sql_yacc.yy
sql/sql_yacc.yy
+0
-7
No files found.
mysql-test/r/parser.result
View file @
28641640
...
...
@@ -930,17 +930,27 @@ ERROR HY000: Invalid use of group function
SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER BY a LIMIT 1;
ERROR HY000: Invalid use of group function
DROP TABLE t1;
# UNION with a parethesized term with ROLLUP
# UNION with a pare
n
thesized term with ROLLUP
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (10),(20),(30);
SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP);
ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
a
1
10
20
30
NULL
SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP) LIMIT 1;
ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
a
1
SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP) ORDER BY a LIMIT 1;
ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
a
NULL
SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP LIMIT 2);
ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
a
1
10
20
SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY a);
ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a));
...
...
@@ -1154,3 +1164,58 @@ ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) AS a FROM t1;
ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
DROP TABLE t1;
MDEV-10101 Wrong error message of SELECT 1 UNION (SELECT 1 FROM t1 GROUP BY 1 WITH ROLLUP)
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (10),(20),(30);
SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP);
a
1
10
20
30
NULL
(SELECT a FROM t1 GROUP BY a WITH ROLLUP) UNION SELECT 1;
a
10
20
30
NULL
1
SELECT a FROM t1 GROUP BY a WITH ROLLUP UNION SELECT 1;
a
10
20
30
NULL
1
SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP) LIMIT 1;
a
1
(SELECT a FROM t1 GROUP BY a WITH ROLLUP) UNION SELECT 1 LIMIT 1;
a
10
SELECT a FROM t1 GROUP BY a WITH ROLLUP UNION SELECT 1 LIMIT 1;
a
10
SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP) ORDER BY a LIMIT 1;
a
NULL
(SELECT a FROM t1 GROUP BY a WITH ROLLUP) UNION SELECT 1 ORDER BY a LIMIT 1;
a
NULL
SELECT a FROM t1 GROUP BY a WITH ROLLUP UNION SELECT 1 ORDER BY a LIMIT 1;
a
NULL
SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP LIMIT 2);
a
1
10
20
(SELECT a FROM t1 GROUP BY a WITH ROLLUP LIMIT 2) UNION SELECT 1;
a
10
20
1
DROP TABLE t1;
mysql-test/t/parser.test
View file @
28641640
...
...
@@ -1075,18 +1075,16 @@ SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER
SELECT
1
AS
a
UNION
(
SELECT
a
FROM
t1
GROUP
BY
a
ORDER
BY
GROUP_CONCAT
(
a
))
ORDER
BY
a
LIMIT
1
;
DROP
TABLE
t1
;
--
echo
# UNION with a parethesized term with ROLLUP
--
echo
# UNION with a pare
n
thesized term with ROLLUP
CREATE
TABLE
t1
(
a
INT
);
INSERT
INTO
t1
VALUES
(
10
),(
20
),(
30
);
--
error
ER_WRONG_USAGE
SELECT
1
AS
a
UNION
(
SELECT
a
FROM
t1
GROUP
BY
a
WITH
ROLLUP
);
--
error
ER_WRONG_USAGE
SELECT
1
AS
a
UNION
(
SELECT
a
FROM
t1
GROUP
BY
a
WITH
ROLLUP
)
LIMIT
1
;
--
error
ER_WRONG_USAGE
SELECT
1
AS
a
UNION
(
SELECT
a
FROM
t1
GROUP
BY
a
WITH
ROLLUP
)
ORDER
BY
a
LIMIT
1
;
--
error
ER_WRONG_USAGE
SELECT
1
AS
a
UNION
(
SELECT
a
FROM
t1
GROUP
BY
a
WITH
ROLLUP
LIMIT
2
);
--
error
ER_WRONG_USAGE
SELECT
1
AS
a
UNION
(
SELECT
a
FROM
t1
GROUP
BY
a
WITH
ROLLUP
ORDER
BY
a
);
--
error
ER_WRONG_USAGE
...
...
@@ -1225,3 +1223,27 @@ SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a)) FROM t
SELECT
(
SELECT
GROUP_CONCAT
(
a
ORDER
BY
a
)
FROM
t1
GROUP
BY
a
WITH
ROLLUP
ORDER
BY
a
LIMIT
1
)
AS
a
FROM
t1
;
DROP
TABLE
t1
;
--
echo
--
echo
MDEV
-
10101
Wrong
error
message
of
SELECT
1
UNION
(
SELECT
1
FROM
t1
GROUP
BY
1
WITH
ROLLUP
)
--
echo
CREATE
TABLE
t1
(
a
INT
);
INSERT
INTO
t1
VALUES
(
10
),(
20
),(
30
);
SELECT
1
AS
a
UNION
(
SELECT
a
FROM
t1
GROUP
BY
a
WITH
ROLLUP
);
(
SELECT
a
FROM
t1
GROUP
BY
a
WITH
ROLLUP
)
UNION
SELECT
1
;
SELECT
a
FROM
t1
GROUP
BY
a
WITH
ROLLUP
UNION
SELECT
1
;
SELECT
1
AS
a
UNION
(
SELECT
a
FROM
t1
GROUP
BY
a
WITH
ROLLUP
)
LIMIT
1
;
(
SELECT
a
FROM
t1
GROUP
BY
a
WITH
ROLLUP
)
UNION
SELECT
1
LIMIT
1
;
SELECT
a
FROM
t1
GROUP
BY
a
WITH
ROLLUP
UNION
SELECT
1
LIMIT
1
;
SELECT
1
AS
a
UNION
(
SELECT
a
FROM
t1
GROUP
BY
a
WITH
ROLLUP
)
ORDER
BY
a
LIMIT
1
;
(
SELECT
a
FROM
t1
GROUP
BY
a
WITH
ROLLUP
)
UNION
SELECT
1
ORDER
BY
a
LIMIT
1
;
SELECT
a
FROM
t1
GROUP
BY
a
WITH
ROLLUP
UNION
SELECT
1
ORDER
BY
a
LIMIT
1
;
SELECT
1
AS
a
UNION
(
SELECT
a
FROM
t1
GROUP
BY
a
WITH
ROLLUP
LIMIT
2
);
(
SELECT
a
FROM
t1
GROUP
BY
a
WITH
ROLLUP
LIMIT
2
)
UNION
SELECT
1
;
DROP
TABLE
t1
;
sql/sql_yacc.yy
View file @
28641640
...
...
@@ -737,13 +737,6 @@ bool setup_select_in_parentheses(LEX *lex)
my_parse_error(lex->thd, ER_SYNTAX_ERROR);
return TRUE;
}
if (sel->linkage == UNION_TYPE &&
sel->olap != UNSPECIFIED_OLAP_TYPE &&
sel->master_unit()->fake_select_lex)
{
my_error(ER_WRONG_USAGE, MYF(0), "CUBE/ROLLUP", "ORDER BY");
return TRUE;
}
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