Commit 3a36d587 authored by unknown's avatar unknown

do not assign values of left expression of IN/ANN/ANY subquery in case of PS preparation (BUG#4403)


mysql-test/r/ps_2myisam.result:
  changes in results of select without order by
mysql-test/r/ps_3innodb.result:
  changes in results of select without order by
mysql-test/r/ps_5merge.result:
  changes in results of select without order by
mysql-test/r/ps_6bdb.result:
  changes in results of select without order by
sql/item_cmpfunc.cc:
  do not assign values of left expression of IN/ANN/ANY subquery in case of PS preparation
parent 88684077
......@@ -389,12 +389,12 @@ where @arg01 = first.b or first.a = second.a or second.b = @arg02;
a @arg00 a
1 ABC 1
2 ABC 1
3 ABC 1
4 ABC 1
2 ABC 2
2 ABC 3
2 ABC 4
3 ABC 1
3 ABC 3
4 ABC 1
2 ABC 4
4 ABC 4
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
where ? = first.b or first.a = second.a or second.b = ? ';
......@@ -402,12 +402,12 @@ execute stmt1 using @arg00, @arg01, @arg02;
a ? a
1 ABC 1
2 ABC 1
3 ABC 1
4 ABC 1
2 ABC 2
2 ABC 3
2 ABC 4
3 ABC 1
3 ABC 3
4 ABC 1
2 ABC 4
4 ABC 4
test_sequence
------ subquery tests ------
......
......@@ -548,14 +548,14 @@ def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
2.0000 0 1 0
2.0000 0 1 0
18.0000 1 0 1
2.0000 0 1 0
18.0000 1 0 1
execute stmt1 ;
scalar_s exists_s in_s in_row_s
2.0000 0 1 0
2.0000 0 1 0
18.0000 1 0 1
2.0000 0 1 0
18.0000 1 0 1
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
......@@ -572,8 +572,8 @@ def ref 253 1024 0 Y 0 31 63
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 63
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 Using where
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -581,8 +581,8 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 Using where
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -617,15 +617,15 @@ def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
2 0 1 0
2 0 1 0
18 1 0 1
2 0 1 0
18 1 0 1
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
scalar_s exists_s in_s in_row_s
2 0 1 0
2 0 1 0
18 1 0 1
2 0 1 0
18 1 0 1
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
......@@ -643,8 +643,8 @@ def ref 253 1024 0 Y 0 31 63
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 63
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 Using where
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -653,8 +653,8 @@ id select_type table type possible_keys key key_len ref rows Extra
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3 Using where
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 3
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......
......@@ -432,12 +432,12 @@ where @arg01 = first.b or first.a = second.a or second.b = @arg02;
a @arg00 a
1 ABC 1
2 ABC 1
3 ABC 1
4 ABC 1
2 ABC 2
2 ABC 3
2 ABC 4
3 ABC 1
3 ABC 3
4 ABC 1
2 ABC 4
4 ABC 4
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
where ? = first.b or first.a = second.a or second.b = ? ';
......@@ -445,12 +445,12 @@ execute stmt1 using @arg00, @arg01, @arg02;
a ? a
1 ABC 1
2 ABC 1
3 ABC 1
4 ABC 1
2 ABC 2
2 ABC 3
2 ABC 4
3 ABC 1
3 ABC 3
4 ABC 1
2 ABC 4
4 ABC 4
test_sequence
------ subquery tests ------
......@@ -1615,12 +1615,12 @@ where @arg01 = first.b or first.a = second.a or second.b = @arg02;
a @arg00 a
1 ABC 1
2 ABC 1
3 ABC 1
4 ABC 1
2 ABC 2
2 ABC 3
2 ABC 4
3 ABC 1
3 ABC 3
4 ABC 1
2 ABC 4
4 ABC 4
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
where ? = first.b or first.a = second.a or second.b = ? ';
......@@ -1628,12 +1628,12 @@ execute stmt1 using @arg00, @arg01, @arg02;
a ? a
1 ABC 1
2 ABC 1
3 ABC 1
4 ABC 1
2 ABC 2
2 ABC 3
2 ABC 4
3 ABC 1
3 ABC 3
4 ABC 1
2 ABC 4
4 ABC 4
test_sequence
------ subquery tests ------
......
......@@ -389,12 +389,12 @@ where @arg01 = first.b or first.a = second.a or second.b = @arg02;
a @arg00 a
1 ABC 1
2 ABC 1
3 ABC 1
4 ABC 1
2 ABC 2
2 ABC 3
2 ABC 4
3 ABC 1
3 ABC 3
4 ABC 1
2 ABC 4
4 ABC 4
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
where ? = first.b or first.a = second.a or second.b = ? ';
......@@ -402,12 +402,12 @@ execute stmt1 using @arg00, @arg01, @arg02;
a ? a
1 ABC 1
2 ABC 1
3 ABC 1
4 ABC 1
2 ABC 2
2 ABC 3
2 ABC 4
3 ABC 1
3 ABC 3
4 ABC 1
2 ABC 4
4 ABC 4
test_sequence
------ subquery tests ------
......
......@@ -483,7 +483,14 @@ bool Item_in_optimizer::fix_left(THD *thd,
return 1;
cache->setup(args[0]);
cache->store(args[0]);
/*
If it is preparation PS only then we do not know values of parameters =>
cant't get there values and do not need that values.
TODO: during merge with 5.0 it should be changed on !thd->only_prepare()
*/
if (!thd->current_statement)
cache->store(args[0]);
if (cache->cols() == 1)
{
if ((used_tables_cache= args[0]->used_tables()))
......
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