Commit 91827869 authored by unknown's avatar unknown
Browse files

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
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -2174,3 +2174,11 @@ select row(1,2) != ALL (select * from t1);
row(1,2) != ALL (select * from t1)
1
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;
+12 −0
Original line number Diff line number Diff line
@@ -1437,3 +1437,15 @@ select (select 1,2) = (select * from t1);
select  row(1,2) = ANY (select * from t1);
select  row(1,2) != ALL (select * from 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;
+4 −0
Original line number Diff line number Diff line
@@ -995,6 +995,10 @@ Item_in_subselect::row_value_transformer(JOIN *join)
    List_iterator_fast<Item> li(select_lex->item_list);
    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,
					   select_lex->ref_pointer_array+i,
					   (char *) "<no matter>",