Commit 23326969 authored by unknown's avatar unknown

LIMIT is prohibited in IN/ALL/ANY/SOME

parent a637e9c4
......@@ -32,7 +32,7 @@ a
1
SELECT 1 FROM (SELECT (SELECT a) b) c;
Unknown column 'a' in 'field list'
SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id LIMIT 1);
SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id);
id
1
SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1);
......@@ -705,3 +705,9 @@ select 10.5 > ANY (SELECT * from t);
10.5 > ANY (SELECT * from t)
1
drop table t;
create table t (a float);
select 10.5 IN (SELECT * from t LIMIT 1);
This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
select 10.5 IN (SELECT * from t LIMIT 1 UNION SELECT 1.5);
This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
drop table t;
......@@ -15,7 +15,7 @@ SELECT (SELECT 1), a;
SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
-- error 1054
SELECT 1 FROM (SELECT (SELECT a) b) c;
SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id LIMIT 1);
SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id);
-- error 1239
SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1);
SELECT 1 IN (SELECT 1);
......@@ -409,3 +409,11 @@ select 10.5 > ALL (SELECT * from t);
select 1.5 > ANY (SELECT * from t);
select 10.5 > ANY (SELECT * from t);
drop table t;
#LIMIT is not supported now
create table t (a float);
-- error 1235
select 10.5 IN (SELECT * from t LIMIT 1);
-- error 1235
select 10.5 IN (SELECT * from t LIMIT 1 UNION SELECT 1.5);
drop table t;
\ No newline at end of file
......@@ -318,6 +318,13 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex,
compare_func_creator func)
{
DBUG_ENTER("Item_in_subselect::single_value_transformer");
if (select_lex->master_unit()->global_parameters->select_limit !=
HA_POS_ERROR)
{
my_error(ER_NOT_SUPPORTED_YET, MYF(0),
"LIMIT & IN/ALL/ANY/SOME subquery");
DBUG_VOID_RETURN;
}
Item_in_optimizer *optimizer;
substitution= optimizer= new Item_in_optimizer(left_expr, this);
if (!optimizer)
......@@ -334,6 +341,13 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex,
select_lex->master_unit()->dependent= 1;
for (SELECT_LEX * sl= select_lex; sl; sl= sl->next_select())
{
if (select_lex->select_limit != HA_POS_ERROR)
{
my_error(ER_NOT_SUPPORTED_YET, MYF(0),
"LIMIT & IN/ALL/ANY/SOME subquery");
DBUG_VOID_RETURN;
}
select_lex->dependent= 1;
Item *item;
if (sl->item_list.elements > 1)
......
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