summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/null.result19
-rw-r--r--mysql-test/t/null.test21
2 files changed, 40 insertions, 0 deletions
diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result
index 1d76fbf2fb3..bd90b3fe3f3 100644
--- a/mysql-test/r/null.result
+++ b/mysql-test/r/null.result
@@ -156,3 +156,22 @@ drop table t1;
select cast(NULL as signed);
cast(NULL as signed)
NULL
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref_or_null i i 5 const 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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref i i 4 const 7 Using where; Using index
+drop table t1;
diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test
index 9f3b6646e7f..7d30fd06ba7 100644
--- a/mysql-test/t/null.test
+++ b/mysql-test/t/null.test
@@ -98,3 +98,24 @@ explain select * from t1 where a between 2 and 3;
explain select * from t1 where a between 2 and 3 or b is null;
drop table t1;
select cast(NULL as signed);
+
+#
+# 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;
+