From: Date: April 19 2007 1:04am Subject: bk commit into 5.0 tree (sergefp:1.2456) BUG#27939 List-Archive: http://lists.mysql.com/commits/24871 X-Bug: 27939 Message-Id: <20070418230430.E31D6BBC002@pylon64.mylan> Below is the list of changes that have just been committed into a local 5.0 repository of psergey. When psergey does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-04-19 03:04:23+04:00, sergefp@stripped +3 -0 BUG#27939: Early NULLs filtering doesn't work for eq_ref access - Turn it on for JT_EQ_REF access method mysql-test/r/join.result@stripped, 2007-04-19 03:04:20+04:00, sergefp@stripped +28 -0 BUG#27939: Testcase mysql-test/t/join.test@stripped, 2007-04-19 03:04:20+04:00, sergefp@stripped +23 -0 BUG#27939: Testcase sql/sql_select.cc@stripped, 2007-04-19 03:04:20+04:00, sergefp@stripped +3 -2 BUG#27939: Early NULLs filtering doesn't work for eq_ref access - Turn it on for JT_EQ_REF access method # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: sergefp # Host: pylon64.mylan # Root: /home/psergey/mysql-5.0-bug27870-review --- 1.509/sql/sql_select.cc 2007-04-19 03:04:30 +04:00 +++ 1.510/sql/sql_select.cc 2007-04-19 03:04:30 +04:00 @@ -5444,8 +5444,9 @@ for (uint i=join->const_tables ; i < join->tables ; i++) { JOIN_TAB *tab=join->join_tab+i; - if ((tab->type == JT_REF || tab->type == JT_REF_OR_NULL) && - !tab->table->maybe_null) + if ((tab->type == JT_REF || tab->type == JT_EQ_REF || + tab->type == JT_REF_OR_NULL) && + !tab->table->maybe_null) { for (uint keypart= 0; keypart < tab->ref.key_parts; keypart++) { --- 1.41/mysql-test/r/join.result 2007-04-19 03:04:30 +04:00 +++ 1.42/mysql-test/r/join.result 2007-04-19 03:04:30 +04:00 @@ -779,4 +779,32 @@ Name varchar(50) YES NULL DROP VIEW v1; DROP TABLE t1,t2,tv1,tv2; +create table t1 (a int, b int); +insert into t1 values +(NULL, 1), +(NULL, 2), +(NULL, 3), +(NULL, 4); +create table t2 (a int not null, primary key(a)); +insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t3 (a int not null, primary key(a)); +insert into t3 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +flush status; +select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b; +a b a a +explain select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using index +1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index +We expect rnd_next=5, and read_key must be 0 because of short-cutting: +show status like 'Handler_read%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 5 +drop table t1, t2, t3; End of 5.0 tests. --- 1.35/mysql-test/t/join.test 2007-04-19 03:04:30 +04:00 +++ 1.36/mysql-test/t/join.test 2007-04-19 03:04:30 +04:00 @@ -610,4 +610,27 @@ DROP VIEW v1; DROP TABLE t1,t2,tv1,tv2; + +# BUG#27939: Early NULLs filtering doesn't work for eq_ref access +create table t1 (a int, b int); +insert into t1 values + (NULL, 1), + (NULL, 2), + (NULL, 3), + (NULL, 4); + +create table t2 (a int not null, primary key(a)); +insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t3 (a int not null, primary key(a)); +insert into t3 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +flush status; +select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b; +explain select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b; +--echo We expect rnd_next=5, and read_key must be 0 because of short-cutting: +show status like 'Handler_read%'; +drop table t1, t2, t3; + + --echo End of 5.0 tests.