summaryrefslogtreecommitdiff
path: root/mysql-test/t/selectivity.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2014-03-22 12:44:39 -0700
committerIgor Babaev <igor@askmonty.org>2014-03-22 12:44:39 -0700
commit887a210ffc5c38cf9623ad308b68094510f1bfbb (patch)
treea85969eab11e043ec288a9b5f75be924897a2f3b /mysql-test/t/selectivity.test
parentb35296911886143267ea471530e701169e5f7f56 (diff)
downloadmariadb-git-887a210ffc5c38cf9623ad308b68094510f1bfbb.tar.gz
Fixed bug mdev-5931.
After constant table row substitution the where condition may be converted to always true. The function calculate_cond_selectivity_for_table() should take into account this possibility.
Diffstat (limited to 'mysql-test/t/selectivity.test')
-rw-r--r--mysql-test/t/selectivity.test23
1 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/t/selectivity.test b/mysql-test/t/selectivity.test
index 8b7dfdff09f..8774afdc554 100644
--- a/mysql-test/t/selectivity.test
+++ b/mysql-test/t/selectivity.test
@@ -889,4 +889,27 @@ set histogram_type=@save_histogram_type;
set histogram_size=@save_histogram_size;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
+
+--echo #
+--echo # Bug mdev-5931: no where condition after constant table row substitution
+--echo # with optimizer_use_condition_selectivity=3
+--echo #
+
+CREATE TABLE t1 (a varchar(3), b varchar(3)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('foo', 'foo');
+
+CREATE TABLE t2 (c INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1), (2);
+
+set optimizer_use_condition_selectivity=3;
+
+EXPLAIN EXTENDED
+SELECT * FROM t1, t2 WHERE c >= 0 OR a = b ;
+
+SELECT * FROM t1, t2 WHERE c >= 0 OR a = b ;
+
+set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
+
+DROP TABLE t1,t2;
+
set use_stat_tables=@save_use_stat_tables;