Commit b33b4c27 authored by unknown's avatar unknown

null.test, null.result:

  Added test case for bug #4256.
join_outer.result:
  Fixed bug #4256.
item_cmpfunc.h:
  Fixed inconsistency of values of used_tables_cache and
  const_item_cache for Item_func_isnull objects.
  This inconsistency caused bug #4256.


sql/item_cmpfunc.h:
  Fixed inconsistency of values of used_tables_cache and
  const_item_cache for Item_func_isnull objects.
  This inconsistency caused bug #4256.
mysql-test/r/join_outer.result:
  Fixed bug #4256.
mysql-test/r/null.result:
  Added test case for bug #4256.
mysql-test/t/null.test:
  Added test case for bug #4256.
parent 8003fee8
......@@ -91,7 +91,7 @@ grp a c id a c d
NULL NULL NULL NULL NULL NULL
explain select t1.*,t2.* from t1,t2 where t1.a=t2.a and isnull(t2.a)=1;
Comment
Impossible WHERE noticed after reading const tables
Impossible WHERE
explain select t1.*,t2.* from t1 left join t2 on t1.a=t2.a where isnull(t2.a)=1;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 7
......
......@@ -109,3 +109,22 @@ a b c d
0 0000-00-00 00:00:00 0
0 0000-00-00 00:00:00 0
drop table t1;
CREATE TABLE t1(i int, KEY(i));
INSERT INTO t1 VALUES(1);
INSERT INTO t1 SELECT i*2 FROM t1;
INSERT INTO t1 SELECT i*2 FROM t1;
INSERT INTO t1 SELECT i*2 FROM t1;
INSERT INTO t1 SELECT i*2 FROM t1;
INSERT INTO t1 SELECT i*2 FROM t1;
INSERT INTO t1 SELECT i*2 FROM t1;
INSERT INTO t1 SELECT i*2 FROM t1;
INSERT INTO t1 SELECT i*2 FROM t1;
INSERT INTO t1 SELECT i*2 FROM t1;
EXPLAIN SELECT * FROM t1 WHERE i=2 OR i IS NULL;
table type possible_keys key key_len ref rows Extra
t1 range i i 5 NULL 10 Using where; Using index
ALTER TABLE t1 CHANGE i i int NOT NULL;
EXPLAIN SELECT * FROM t1 WHERE i=2 OR i IS NULL;
table type possible_keys key key_len ref rows Extra
t1 range i i 4 NULL 7 Using where; Using index
DROP TABLE t1;
......@@ -79,3 +79,26 @@ INSERT INTO t1 (d) values (null),(null);
select * from t1;
drop table t1;
# Test case for bug #4256
CREATE TABLE t1(i int, KEY(i));
INSERT INTO t1 VALUES(1);
INSERT INTO t1 SELECT i*2 FROM t1;
INSERT INTO t1 SELECT i*2 FROM t1;
INSERT INTO t1 SELECT i*2 FROM t1;
INSERT INTO t1 SELECT i*2 FROM t1;
INSERT INTO t1 SELECT i*2 FROM t1;
INSERT INTO t1 SELECT i*2 FROM t1;
INSERT INTO t1 SELECT i*2 FROM t1;
INSERT INTO t1 SELECT i*2 FROM t1;
INSERT INTO t1 SELECT i*2 FROM t1;
EXPLAIN SELECT * FROM t1 WHERE i=2 OR i IS NULL;
ALTER TABLE t1 CHANGE i i int NOT NULL;
EXPLAIN SELECT * FROM t1 WHERE i=2 OR i IS NULL;
DROP TABLE t1;
......@@ -469,6 +469,7 @@ class Item_func_isnull :public Item_bool_func
if (!args[0]->maybe_null)
{
used_tables_cache= 0; /* is always false */
const_item_cache= 1;
cached_value= (longlong) 0;
}
else
......
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