Commit 070fe467 authored by unknown's avatar unknown

fixed left expression of IN/ALL/ANY subquery transformation support (BUG#8888)


mysql-test/r/subselect.result:
  result changing
  fixed last test
  test of transformation of left expression of subquery
mysql-test/t/subselect.test:
  fixed last test
  test of transformation of left expression of subquery
sql/item_subselect.cc:
  fixfields made for left part of IN/ALL/ANY subquery before calling cols() to detect type of transformation (scalar or row)
  similar action of both transformation moved to separate function
sql/item_subselect.h:
  optimised field initialization and new method
parent 100f7926
......@@ -2128,7 +2128,7 @@ drop table t1;
create table t1 (a1 int);
create table t2 (b1 int);
select * from t1 where a2 > any(select b1 from t2);
ERROR 42S22: Unknown column 'a2' in 'scalar IN/ALL/ANY subquery'
ERROR 42S22: Unknown column 'a2' in 'IN/ALL/ANY subquery'
select * from t1 where a1 > any(select b1 from t2);
a1
drop table t1,t2;
......@@ -2267,4 +2267,12 @@ pass userid parentid parentgroup childid groupname grouptypeid crse categoryid c
1 5141 12 group2 12 group2 5 1 1 87 Oct04
1 5141 12 group2 12 group2 5 1 2 88 Oct04
1 5141 12 group2 12 group2 5 1 2 89 Oct04
drop table if exists t1, t2, t3, t4, t5;
drop table t1, t2, t3, t4, t5;
create table t1 (a int);
insert into t1 values (1), (2), (3);
SELECT 1 FROM t1 WHERE (SELECT 1) in (SELECT 1);
1
1
1
1
drop table t1;
......@@ -1438,8 +1438,9 @@ select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
drop table t1;
#
# Test for BUG#8218
#
CREATE TABLE t1 (
categoryId int(11) NOT NULL,
courseId int(11) NOT NULL,
......@@ -1536,5 +1537,12 @@ join
group by
groupstuff.groupname, colhead , t2.courseid;
drop table if exists t1, t2, t3, t4, t5;
drop table t1, t2, t3, t4, t5;
#
# Transformation in left expression of subquery (BUG#8888)
#
create table t1 (a int);
insert into t1 values (1), (2), (3);
SELECT 1 FROM t1 WHERE (SELECT 1) in (SELECT 1);
drop table t1;
This diff is collapsed.
......@@ -220,8 +220,8 @@ public:
Item_in_subselect(Item * left_expr, st_select_lex *select_lex);
Item_in_subselect()
:Item_exists_subselect(), abort_on_null(0), transformed(0), upper_item(0)
:Item_exists_subselect(), optimizer(0), abort_on_null(0), transformed(0),
upper_item(0)
{}
subs_type substype() { return IN_SUBS; }
......@@ -232,8 +232,8 @@ public:
was_null= 0;
}
trans_res select_transformer(JOIN *join);
trans_res single_value_transformer(JOIN *join,
Comp_creator *func);
trans_res select_in_like_transformer(JOIN *join, Comp_creator *func);
trans_res single_value_transformer(JOIN *join, Comp_creator *func);
trans_res row_value_transformer(JOIN * join);
longlong val_int();
double val();
......
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