Below is the list of changes that have just been committed into a local
5.1 repository of gshchepa. When gshchepa does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-09-24 00:02:39+02:00, gshchepa@stripped +3 -0
Fixed bug #31075.
The `SELECT col FROM t WHERE col NOT IN (col, ...) GROUP BY col'
crashed in the range optimizer.
The get_func_mm_tree function has been modified to check the
Item_func_in::array field for the NULL value before using of that
value.
mysql-test/r/func_in.result@stripped, 2007-09-24 00:02:19+02:00, gshchepa@stripped
+7 -2
Added test case for bug #31075.
Updated test case for bug #20420.
mysql-test/t/func_in.test@stripped, 2007-09-24 00:02:17+02:00, gshchepa@stripped
+8 -0
Added test case for bug #31075.
sql/opt_range.cc@stripped, 2007-09-24 00:02:14+02:00, gshchepa@stripped +1 -1
Fixed bug #31075.
The get_func_mm_tree function has been modified to check the
Item_func_in::array field for the NULL value before using of that
value.
diff -Nrup a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
--- a/mysql-test/r/func_in.result 2007-06-28 19:34:47 +02:00
+++ b/mysql-test/r/func_in.result 2007-09-24 00:02:19 +02:00
@@ -372,15 +372,15 @@ id select_type table type possible_keys
1 SIMPLE t3 index PRIMARY PRIMARY 4 NULL 4 Using index
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.a 1
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.a 1
-1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 7 Range checked for each record (index map: 0x1)
+1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 7 Using where; Using join buffer
SELECT STRAIGHT_JOIN * FROM t3
JOIN t1 ON t3.a=t1.a
JOIN t2 ON t3.a=t2.a
JOIN t4 WHERE t4.a IN (t1.b, t2.b);
a a b a b a b
3 3 1 3 2 1 1
-3 3 1 3 2 2 2
4 4 1 4 2 1 1
+3 3 1 3 2 2 2
4 4 1 4 2 2 2
EXPLAIN SELECT STRAIGHT_JOIN
(SELECT SUM(t4.a) FROM t4 WHERE t4.a IN (t1.b, t2.b))
@@ -564,4 +564,9 @@ explain select f2 from t2 where f2 in (1
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index t2f2 t2f2 5 NULL 3 Using where; Using index
drop table t1, t2;
+create table t1 (a time, key(a));
+insert into t1 values (),(),(),(),(),(),(),(),(),();
+select a from t1 where a not in (a,a,a) group by a;
+a
+drop table t1;
End of 5.1 tests
diff -Nrup a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
--- a/mysql-test/t/func_in.test 2007-06-13 11:16:36 +02:00
+++ b/mysql-test/t/func_in.test 2007-09-24 00:02:17 +02:00
@@ -408,5 +408,13 @@ select f2 from t2 where f2 in (1,'b');
explain select f2 from t2 where f2 in (1,'b');
drop table t1, t2;
+#
+# Bug #31075: crash in get_func_mm_tree
+#
+
+create table t1 (a time, key(a));
+insert into t1 values (),(),(),(),(),(),(),(),(),();
+select a from t1 where a not in (a,a,a) group by a;
+drop table t1;
--echo End of 5.1 tests
diff -Nrup a/sql/opt_range.cc b/sql/opt_range.cc
--- a/sql/opt_range.cc 2007-09-21 12:17:00 +02:00
+++ b/sql/opt_range.cc 2007-09-24 00:02:14 +02:00
@@ -5048,7 +5048,7 @@ static SEL_TREE *get_func_mm_tree(RANGE_
type. Tree won't be built for values with different result types,
so we check it here to avoid unnecessary work.
*/
- if (!func->arg_types_compatible)
+ if (!func->array || !func->arg_types_compatible)
break;
if (inv)
| Thread |
|---|
| • bk commit into 5.1 tree (gshchepa:1.2562) BUG#31075 | gshchepa | 24 Sep |