summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-11-11 11:47:44 -0800
committerIgor Babaev <igor@askmonty.org>2012-11-11 11:47:44 -0800
commite08f4f16303c234c82c397414c24c931b679f84a (patch)
tree8bbeaeca4d2bb24dfc13acfd32c5e56307d1c293 /mysql-test
parent0380b0e28034c8e5778e37540478f61d3d74a0bc (diff)
downloadmariadb-git-e08f4f16303c234c82c397414c24c931b679f84a.tar.gz
Fixed bug mdev-3851.
Any ref access to a table by a key fully extended by the components of the primary key should be actually an eq_ref access.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/innodb_ext_key.result20
-rw-r--r--mysql-test/t/innodb_ext_key.test21
2 files changed, 41 insertions, 0 deletions
diff --git a/mysql-test/r/innodb_ext_key.result b/mysql-test/r/innodb_ext_key.result
index d2fb29a023c..0b7b042a0b2 100644
--- a/mysql-test/r/innodb_ext_key.result
+++ b/mysql-test/r/innodb_ext_key.result
@@ -613,6 +613,26 @@ Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
+#
+# Bug mdev-3851: ref access used instead of expected eq_ref access
+# when extended_keys=on
+#
+create table t0 (a int);
+insert into t0 values (1), (2), (3), (4), (5);
+create index i_p_size on part(p_size);
+set optimizer_switch='extended_keys=on';
+explain
+select * from t0, part ignore index (primary)
+where p_partkey=t0.a and p_size=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 5 Using where
+1 SIMPLE part eq_ref i_p_size i_p_size 9 const,dbt3_s001.t0.a 1
+select * from t0, part ignore index (primary)
+where p_partkey=t0.a and p_size=1;
+a p_partkey p_name p_mfgr p_brand p_type p_size p_container p_retailprice p_comment
+2 2 blush rosy metallic lemon navajo Manufacturer#1 Brand#13 LARGE BRUSHED BRASS 1 LG CASE 902 final platelets hang f
+drop table t0;
+drop index i_p_size on part;
DROP DATABASE dbt3_s001;
use test;
#
diff --git a/mysql-test/t/innodb_ext_key.test b/mysql-test/t/innodb_ext_key.test
index 58d692f720d..f5b5df527a3 100644
--- a/mysql-test/t/innodb_ext_key.test
+++ b/mysql-test/t/innodb_ext_key.test
@@ -287,6 +287,27 @@ select o_orderkey, p_partkey
and o_orderkey=l_orderkey and p_partkey=l_partkey;
show status like 'handler_read%';
+--echo #
+--echo # Bug mdev-3851: ref access used instead of expected eq_ref access
+--echo # when extended_keys=on
+--echo #
+
+create table t0 (a int);
+insert into t0 values (1), (2), (3), (4), (5);
+create index i_p_size on part(p_size);
+
+set optimizer_switch='extended_keys=on';
+
+explain
+select * from t0, part ignore index (primary)
+ where p_partkey=t0.a and p_size=1;
+
+select * from t0, part ignore index (primary)
+ where p_partkey=t0.a and p_size=1;
+
+drop table t0;
+drop index i_p_size on part;
+
DROP DATABASE dbt3_s001;
use test;