summaryrefslogtreecommitdiff
path: root/mysql-test/main/selectivity.test
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-09-26 20:49:51 +0200
committerSergei Golubchik <serg@mariadb.org>2018-09-28 16:37:06 +0200
commit57e0da50bbef8164635317785b67dd468a908327 (patch)
tree89d1ed179afce8b040c8f2dfcfe179042ff27b2e /mysql-test/main/selectivity.test
parent7aba6f8f8853acd18d471793f8b72aa1412b8151 (diff)
parentdcbd51cee628d8d8fec9ff5476a6afc855b007aa (diff)
downloadmariadb-git-57e0da50bbef8164635317785b67dd468a908327.tar.gz
Merge branch '10.2' into 10.3
Diffstat (limited to 'mysql-test/main/selectivity.test')
-rw-r--r--mysql-test/main/selectivity.test36
1 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/main/selectivity.test b/mysql-test/main/selectivity.test
index cf12bdaea21..3df49456332 100644
--- a/mysql-test/main/selectivity.test
+++ b/mysql-test/main/selectivity.test
@@ -1066,3 +1066,39 @@ drop table t1,t0;
set histogram_size=@save_histogram_size;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
+
+--echo #
+--echo # MDEV-15306: Wrong/Unexpected result with the value
+--echo # optimizer_use_condition_selectivity set to 4
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+
+delimiter |;
+CREATE FUNCTION f1() RETURNS INT DETERMINISTIC
+BEGIN
+ SET @cnt := @cnt + 1;
+ RETURN 1;
+END;|
+delimiter ;|
+set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
+set @save_use_stat_tables= @@use_stat_tables;
+set @@use_stat_tables='complementary';
+set @@optimizer_use_condition_selectivity=4;
+SET @cnt= 0;
+SELECT * FROM t1 WHERE a = f1();
+SELECT @cnt;
+
+set @@use_stat_tables='preferably';
+analyze table t1 persistent for all;
+SET @cnt := 0;
+set @@optimizer_use_condition_selectivity=4;
+SELECT * FROM t1 WHERE a = f1();
+SELECT @cnt;
+alter table t1 force;
+set @@use_stat_tables= @save_use_stat_tables;
+set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
+drop table t1;
+drop function f1;
+