Commit 91827869 authored by unknown's avatar unknown

check that row elements have the same dimention that SELECT list elements in...

check that row elements have the same dimention that SELECT list elements in comporison between rows and subqueries added (BUG#8022)


mysql-test/r/subselect.result:
  Comparison subquery and row with nested rows
mysql-test/t/subselect.test:
  Comparison subquery and row with nested rows
sql/item_subselect.cc:
  check that row elements have the same dimention that SELECT list elements
parent d514a06a
...@@ -2174,3 +2174,11 @@ select row(1,2) != ALL (select * from t1); ...@@ -2174,3 +2174,11 @@ select row(1,2) != ALL (select * from t1);
row(1,2) != ALL (select * from t1) row(1,2) != ALL (select * from t1)
1 1
drop table t1; drop table t1;
create table t1 (a integer, b integer);
select row(1,(2,2)) in (select * from t1 );
ERROR 21000: Operand should contain 2 column(s)
select row(1,(2,2)) = (select * from t1 );
ERROR 21000: Operand should contain 2 column(s)
select (select * from t1) = row(1,(2,2));
ERROR 21000: Operand should contain 1 column(s)
drop table t1;
...@@ -1437,3 +1437,15 @@ select (select 1,2) = (select * from t1); ...@@ -1437,3 +1437,15 @@ select (select 1,2) = (select * from t1);
select row(1,2) = ANY (select * from t1); select row(1,2) = ANY (select * from t1);
select row(1,2) != ALL (select * from t1); select row(1,2) != ALL (select * from t1);
drop table t1; drop table t1;
#
# Comparison subquery and row with nested rows
#
create table t1 (a integer, b integer);
-- error 1241
select row(1,(2,2)) in (select * from t1 );
-- error 1241
select row(1,(2,2)) = (select * from t1 );
-- error 1241
select (select * from t1) = row(1,(2,2));
drop table t1;
...@@ -995,6 +995,10 @@ Item_in_subselect::row_value_transformer(JOIN *join) ...@@ -995,6 +995,10 @@ Item_in_subselect::row_value_transformer(JOIN *join)
List_iterator_fast<Item> li(select_lex->item_list); List_iterator_fast<Item> li(select_lex->item_list);
for (uint i= 0; i < n; i++) for (uint i= 0; i < n; i++)
{ {
DBUG_ASSERT(left_expr->fixed && select_lex->ref_pointer_array[i]->fixed);
if (select_lex->ref_pointer_array[i]->
check_cols(left_expr->el(i)->cols()))
goto err;
Item *func= new Item_ref_null_helper(this, Item *func= new Item_ref_null_helper(this,
select_lex->ref_pointer_array+i, select_lex->ref_pointer_array+i,
(char *) "<no matter>", (char *) "<no matter>",
......
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