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
This commit is contained in:
unknown 2005-01-24 15:56:57 +02:00
parent d514a06a86
commit 9182786918
3 changed files with 24 additions and 0 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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>",