#At file:///data/src/bzr/bugteam/bug46159/my60-bug46159/ based on revid:alexey.kopytov@stripped
3557 Alexey Kopytov 2009-10-15 [merge]
Automerge.
modified:
mysql-test/r/range.result
mysql-test/t/range.test
sql/opt_range.cc
=== modified file 'mysql-test/r/range.result'
--- a/mysql-test/r/range.result 2008-06-10 22:27:52 +0000
+++ b/mysql-test/r/range.result 2009-10-15 09:50:06 +0000
@@ -1219,6 +1219,14 @@ explain select * from t2 where a=1000 an
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref a a 5 const 502 Using index condition
drop table t1, t2;
+#
+# Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN
+#
+CREATE TABLE t1(a INT, KEY(a));
+INSERT INTO t1 VALUES (1), (NULL);
+SELECT * FROM t1 WHERE a <> NULL and (a <> NULL or a <= NULL);
+a
+DROP TABLE t1;
End of 5.1 tests
CREATE TABLE t1 (c1 DECIMAL(10,0),INDEX(c1));
INSERT INTO t1 VALUES (1),(2),(3);
=== modified file 'mysql-test/t/range.test'
--- a/mysql-test/t/range.test 2008-06-10 22:27:52 +0000
+++ b/mysql-test/t/range.test 2009-10-15 09:50:06 +0000
@@ -1046,6 +1046,15 @@ explain select * from t2 where a=1000 an
drop table t1, t2;
+--echo #
+--echo # Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN
+--echo #
+
+CREATE TABLE t1(a INT, KEY(a));
+INSERT INTO t1 VALUES (1), (NULL);
+SELECT * FROM t1 WHERE a <> NULL and (a <> NULL or a <= NULL);
+DROP TABLE t1;
+
--echo End of 5.1 tests
#
@@ -1066,4 +1075,3 @@ create table t2 (c int);
insert into t2(c) values (1),(5),(6),(7),(8);
select 1 from (select c from t1,t2 where b >= 1 and a <=> c group by 1 limit 1) as d1;
drop table t1, t2;
-
=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc 2009-08-27 08:07:07 +0000
+++ b/sql/opt_range.cc 2009-10-15 09:50:06 +0000
@@ -5869,6 +5869,17 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND
goto end;
}
field->table->in_use->variables.sql_mode= orig_sql_mode;
+
+ /*
+ Any sargable predicate except "<=>" involving NULL as a constant is always
+ FALSE
+ */
+ if (type != Item_func::EQUAL_FUNC && field->is_real_null())
+ {
+ tree= &null_element;
+ goto end;
+ }
+
str= (uchar*) alloc_root(alloc, key_part->store_length+1);
if (!str)
goto end;
Attachment: [text/bzr-bundle] bzr/alexey.kopytov@sun.com-20091015095006-e0udea3hzyk559f5.bundle
| Thread |
|---|
| • bzr commit into mysql-5.4 branch (Alexey.Kopytov:3557) | Alexey Kopytov | 15 Oct |