Commit 4c0e2960 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-10051 Fix subselect to return a syntax error instead of "Incorrect usage of UNION and LIMIT"

parent a999acf2
...@@ -820,19 +820,19 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp ...@@ -820,19 +820,19 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1; SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1' at line 1
SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1); SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1);
ERROR HY000: Incorrect usage of UNION and ORDER BY ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1)' at line 1
SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1) a; SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1) a;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1) a' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1) a' at line 1
SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1; SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1' at line 1
SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1); SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1);
ERROR HY000: Incorrect usage of UNION and LIMIT ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1)' at line 1
SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1) a; SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1) a;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1) a' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1) a' at line 1
SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1; SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1' at line 1
SELECT (SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1); SELECT (SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1);
ERROR HY000: Incorrect usage of UNION and ORDER BY ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1)' at line 1
SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1) a; SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1) a;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1) a' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1) a' at line 1
SELECT 1 FROM t1 LIMIT 1 ORDER BY 1 UNION SELECT 1 FROM t1; SELECT 1 FROM t1 LIMIT 1 ORDER BY 1 UNION SELECT 1 FROM t1;
...@@ -844,25 +844,25 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp ...@@ -844,25 +844,25 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1; SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1' at line 1
SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1); SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1);
ERROR HY000: Incorrect usage of UNION and ORDER BY ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1)' at line 1
SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1) a; SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1) a;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1) a' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1) a' at line 1
SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1; SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1' at line 1
SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1); SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1);
ERROR HY000: Incorrect usage of UNION and LIMIT ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1)' at line 1
SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1) a; SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1) a;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1) a' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1) a' at line 1
SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1; SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1' at line 1
SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1); SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1);
ERROR HY000: Incorrect usage of UNION and LIMIT ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1)' at line 1
SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1) a; SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1) a;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1) a' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1) a' at line 1
SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1; SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1' at line 1
SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1); SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1);
ERROR HY000: Incorrect usage of UNION and ORDER BY ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1)' at line 1
SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1) a; SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1) a;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1) a' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1) a' at line 1
DROP TABLE t1; DROP TABLE t1;
......
...@@ -1056,7 +1056,7 @@ create table t1 (a float); ...@@ -1056,7 +1056,7 @@ create table t1 (a float);
select 10.5 IN (SELECT * from t1 LIMIT 1); select 10.5 IN (SELECT * from t1 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5); select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
ERROR HY000: Incorrect usage of UNION and LIMIT ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1.5)' at line 1
select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1); select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
drop table t1; drop table t1;
......
...@@ -1060,7 +1060,7 @@ create table t1 (a float); ...@@ -1060,7 +1060,7 @@ create table t1 (a float);
select 10.5 IN (SELECT * from t1 LIMIT 1); select 10.5 IN (SELECT * from t1 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5); select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
ERROR HY000: Incorrect usage of UNION and LIMIT ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1.5)' at line 1
select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1); select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
drop table t1; drop table t1;
......
...@@ -1063,7 +1063,7 @@ create table t1 (a float); ...@@ -1063,7 +1063,7 @@ create table t1 (a float);
select 10.5 IN (SELECT * from t1 LIMIT 1); select 10.5 IN (SELECT * from t1 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5); select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
ERROR HY000: Incorrect usage of UNION and LIMIT ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1.5)' at line 1
select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1); select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
drop table t1; drop table t1;
......
...@@ -1059,7 +1059,7 @@ create table t1 (a float); ...@@ -1059,7 +1059,7 @@ create table t1 (a float);
select 10.5 IN (SELECT * from t1 LIMIT 1); select 10.5 IN (SELECT * from t1 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5); select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
ERROR HY000: Incorrect usage of UNION and LIMIT ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1.5)' at line 1
select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1); select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
drop table t1; drop table t1;
......
...@@ -1062,7 +1062,7 @@ create table t1 (a float); ...@@ -1062,7 +1062,7 @@ create table t1 (a float);
select 10.5 IN (SELECT * from t1 LIMIT 1); select 10.5 IN (SELECT * from t1 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5); select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
ERROR HY000: Incorrect usage of UNION and LIMIT ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1.5)' at line 1
select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1); select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
drop table t1; drop table t1;
......
...@@ -1059,7 +1059,7 @@ create table t1 (a float); ...@@ -1059,7 +1059,7 @@ create table t1 (a float);
select 10.5 IN (SELECT * from t1 LIMIT 1); select 10.5 IN (SELECT * from t1 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5); select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
ERROR HY000: Incorrect usage of UNION and LIMIT ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1.5)' at line 1
select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1); select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
drop table t1; drop table t1;
......
...@@ -949,7 +949,7 @@ eval SELECT 1 FROM ($q) a; ...@@ -949,7 +949,7 @@ eval SELECT 1 FROM ($q) a;
let $q=SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1; let $q=SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
eval $q; eval $q;
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
eval SELECT ($q); eval SELECT ($q);
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
eval SELECT 1 FROM ($q) a; eval SELECT 1 FROM ($q) a;
...@@ -957,7 +957,7 @@ eval SELECT 1 FROM ($q) a; ...@@ -957,7 +957,7 @@ eval SELECT 1 FROM ($q) a;
let $q=SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1; let $q=SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
eval $q; eval $q;
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
eval SELECT ($q); eval SELECT ($q);
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
eval SELECT 1 FROM ($q) a; eval SELECT 1 FROM ($q) a;
...@@ -965,7 +965,7 @@ eval SELECT 1 FROM ($q) a; ...@@ -965,7 +965,7 @@ eval SELECT 1 FROM ($q) a;
let $q=SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1; let $q=SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
eval $q; eval $q;
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
eval SELECT ($q); eval SELECT ($q);
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
eval SELECT 1 FROM ($q) a; eval SELECT 1 FROM ($q) a;
...@@ -981,7 +981,7 @@ eval SELECT 1 FROM ($q) a; ...@@ -981,7 +981,7 @@ eval SELECT 1 FROM ($q) a;
let $q=SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1; let $q=SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
eval $q; eval $q;
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
eval SELECT ($q); eval SELECT ($q);
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
eval SELECT 1 FROM ($q) a; eval SELECT 1 FROM ($q) a;
...@@ -989,7 +989,7 @@ eval SELECT 1 FROM ($q) a; ...@@ -989,7 +989,7 @@ eval SELECT 1 FROM ($q) a;
let $q=SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1; let $q=SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
eval $q; eval $q;
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
eval SELECT ($q); eval SELECT ($q);
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
eval SELECT 1 FROM ($q) a; eval SELECT 1 FROM ($q) a;
...@@ -997,7 +997,7 @@ eval SELECT 1 FROM ($q) a; ...@@ -997,7 +997,7 @@ eval SELECT 1 FROM ($q) a;
let $q=SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1; let $q=SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
eval $q; eval $q;
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
eval SELECT ($q); eval SELECT ($q);
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
eval SELECT 1 FROM ($q) a; eval SELECT 1 FROM ($q) a;
...@@ -1005,7 +1005,7 @@ eval SELECT 1 FROM ($q) a; ...@@ -1005,7 +1005,7 @@ eval SELECT 1 FROM ($q) a;
let $q=SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1; let $q=SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
eval $q; eval $q;
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
eval SELECT ($q); eval SELECT ($q);
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
eval SELECT 1 FROM ($q) a; eval SELECT 1 FROM ($q) a;
......
...@@ -569,7 +569,7 @@ drop table t1, t2; ...@@ -569,7 +569,7 @@ drop table t1, t2;
create table t1 (a float); create table t1 (a float);
-- error ER_NOT_SUPPORTED_YET -- error ER_NOT_SUPPORTED_YET
select 10.5 IN (SELECT * from t1 LIMIT 1); select 10.5 IN (SELECT * from t1 LIMIT 1);
-- error ER_WRONG_USAGE -- error ER_PARSE_ERROR
select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5); select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
-- error ER_NOT_SUPPORTED_YET -- error ER_NOT_SUPPORTED_YET
select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1); select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1);
......
...@@ -1883,7 +1883,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -1883,7 +1883,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
select_derived derived_table_list select_derived derived_table_list
select_derived_union select_derived_union
derived_query_specification derived_query_specification
%type <date_time_type> date_time_type; %type <date_time_type> date_time_type;
%type <interval> interval %type <interval> interval
...@@ -1922,7 +1921,11 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -1922,7 +1921,11 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <select_lex> subselect %type <select_lex> subselect
get_select_lex get_select_lex_derived get_select_lex get_select_lex_derived
query_specification
query_term_union_not_ready
query_term_union_ready
query_expression_body query_expression_body
select_paren_derived
%type <boolfunc2creator> comp_op %type <boolfunc2creator> comp_op
...@@ -8555,8 +8558,9 @@ select_paren_derived: ...@@ -8555,8 +8558,9 @@ select_paren_derived:
{ {
if (setup_select_in_parentheses(Lex)) if (setup_select_in_parentheses(Lex))
MYSQL_YYABORT; MYSQL_YYABORT;
$$= Lex->current_select->master_unit()->first_select();
} }
| '(' select_paren_derived ')' | '(' select_paren_derived ')' { $$= $2; }
; ;
select_init3: select_init3:
...@@ -16402,33 +16406,25 @@ union_option: ...@@ -16402,33 +16406,25 @@ union_option:
*/ */
query_specification: query_specification:
SELECT_SYM select_init2_derived opt_table_expression SELECT_SYM select_init2_derived opt_table_expression
; {
$$= Lex->current_select->master_unit()->first_select();
query_term: }
query_term_union_ready
| query_term_union_not_ready
; ;
query_term_union_not_ready: query_term_union_not_ready:
query_specification order_or_limit opt_select_lock_type query_specification order_or_limit opt_select_lock_type { $$= $1; }
| '(' select_paren_derived ')' union_order_or_limit | '(' select_paren_derived ')' union_order_or_limit { $$= $2; }
; ;
query_term_union_ready: query_term_union_ready:
query_specification opt_select_lock_type query_specification opt_select_lock_type { $$= $1; }
| '(' select_paren_derived ')' | '(' select_paren_derived ')' { $$= $2; }
; ;
query_expression_body: query_expression_body:
query_term query_term_union_not_ready { $$= $1; }
{ | query_term_union_ready { $$= $1; }
$$= Lex->current_select->master_unit()->first_select(); | query_term_union_ready union_list_derived { $$= $1; }
}
| query_expression_body union_head_non_top query_term
{
Lex->pop_context();
$$= $1;
}
; ;
/* Corresponds to <query expression> in the SQL:2003 standard. */ /* Corresponds to <query expression> in the SQL:2003 standard. */
......
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