diff options
author | Magne Mahre <magne.mahre@oracle.com> | 2011-01-10 13:43:12 +0100 |
---|---|---|
committer | Magne Mahre <magne.mahre@oracle.com> | 2011-01-10 13:43:12 +0100 |
commit | 90650edf697d498d0969f4bd9b81301ffc633dfa (patch) | |
tree | b14518869f4fdf7e6c6d3d43b1ab29117bbdc74b /sql | |
parent | 1b64516756174c5de34ad77e54e3ecf164863ec4 (diff) | |
download | mariadb-git-90650edf697d498d0969f4bd9b81301ffc633dfa.tar.gz |
Bug#58970 Problem Subquery (without referencing a table)
and Order By
When having a UNION statement in a subquery, with no
referenced tables (or only a reference to the virtual
table 'dual'), the UNION did not allow an ORDER BY clause.
i.e:
SELECT(SELECT 1 AS a UNION
SELECT 0 AS a
ORDER BY a) AS b or
SELECT(SELECT 1 AS a FROM dual UNION
SELECT 0 as a
ORDER BY a) AS b
In addition, an ORDER BY / LIMIT clause was not accepted
in subqueries even for single SELECT statements with no
referenced tables (or with 'dual' as table reference)
i.e:
SELECT(SELECT 1 AS a ORDER BY a) AS b or
SELECT(SELECT 1 AS a FROM dual ORDER BY a) AS b
The fix was to allow an optional ORDER BY/LIMIT clause to
the grammar for these cases.
See also: Bug#57986
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_yacc.yy | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index c283747156a..397afd26d8d 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -13914,7 +13914,7 @@ query_specification: ; query_expression_body: - query_specification + query_specification opt_union_order_or_limit | query_expression_body UNION_SYM union_option { @@ -13922,6 +13922,7 @@ query_expression_body: MYSQL_YYABORT; } query_specification + opt_union_order_or_limit { Lex->pop_context(); $$= $1; |