diff options
author | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2009-10-13 19:49:32 +0400 |
---|---|---|
committer | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2009-10-13 19:49:32 +0400 |
commit | 5db734a896bff99d044eb6e08bb5c849d04915ef (patch) | |
tree | 0352cfe65d706d5683e1a8731ff58b2c52369be3 /mysql-test/r/range.result | |
parent | f1617238210eb110f483dddef212efbeb5ad4e3d (diff) | |
download | mariadb-git-5db734a896bff99d044eb6e08bb5c849d04915ef.tar.gz |
Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN
The problem was in incorrect handling of predicates involving
NULL as a constant value by the range optimizer.
For example, when creating a SEL_ARG node from a condition of
the form "field < const" (which would normally result in the
"NULL < field < const" SEL_ARG), the special case when "const"
is NULL was not taken into account, so "NULL < field < NULL"
was produced for the "field < NULL" condition.
As a result, SEL_ARG structures of this form could not be
further optimized which in turn could lead to incorrectly
constructed SEL_ARG trees. In particular, code assuming SEL_ARG
structures to always form a sequence of ordered disjoint
intervals could enter an infinite loop under some
circumstances.
Fixed by changing get_mm_leaf() so that for any sargable
predicate except "<=>" involving NULL as a constant, "empty"
SEL_ARG is returned, since such a predicate is always false.
Diffstat (limited to 'mysql-test/r/range.result')
-rw-r--r-- | mysql-test/r/range.result | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index cc5e8d2be96..69ae81982a9 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -1219,3 +1219,12 @@ explain select * from t2 where a=1000 and b<11; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref a a 5 const 502 Using where 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 |