summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2014-10-28 22:31:52 -0700
committerIgor Babaev <igor@askmonty.org>2014-10-28 22:31:52 -0700
commit100b10d8efbcbc936d742b87aacf49dab037333f (patch)
tree33cd992dc65d7bd5d585f09169d1f14ac5929f53 /mysql-test/t
parent2d088e265ce3ca0523846ec97c7b3b2c4e6cba67 (diff)
downloadmariadb-git-100b10d8efbcbc936d742b87aacf49dab037333f.tar.gz
Fixed bug mdev-6843.
The function get_column_range_cardinality() returned a wrong result for any column containing only null values.
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/selectivity.test29
1 files changed, 29 insertions, 0 deletions
diff --git a/mysql-test/t/selectivity.test b/mysql-test/t/selectivity.test
index 16226b07751..5db6f3b9d6a 100644
--- a/mysql-test/t/selectivity.test
+++ b/mysql-test/t/selectivity.test
@@ -912,6 +912,35 @@ select * from t1 straight_join t2 where t1.a=t2.a and t1.a<10;
explain extended
select * from t1 straight_join t2 where t1.a=t2.a and t2.a<10;
+set histogram_size=@save_histogram_size;
+set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
+
+drop table t0,t1,t2;
+
+--echo #
+--echo # Bug mdev-6843: col IS NULL in where condition when col is always NULL
+--echo #
+
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1(a int);
+insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
+create table t2 (a int, b int);
+insert into t2 select NULL, a from t1;
+
+set use_stat_tables='preferably';
+set histogram_size=100;
+
+set optimizer_use_condition_selectivity=4;
+analyze table t2 persistent for all;
+
+explain extended
+select * from t2 A straight_join t2 B where A.a is null;
+
+set histogram_size=@save_histogram_size;
+set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
+
drop table t0,t1,t2;
set use_stat_tables=@save_use_stat_tables;
+