diff options
Diffstat (limited to '')
-rw-r--r-- | mysql-test/main/join.test | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/mysql-test/main/join.test b/mysql-test/main/join.test index a4d34f41..7a8c6a09 100644 --- a/mysql-test/main/join.test +++ b/mysql-test/main/join.test @@ -253,7 +253,7 @@ CREATE TABLE t2 ( PRIMARY KEY (id) ) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,'s1'),(2,'s2'),(3,'s3'),(4,'s4'),(5,'s5'); -select t1.*, t2.* from t1, t2 where t2.id=t1.t2_id limit 2; +select straight_join t1.*, t2.* from t2, t1 where t2.id=t1.t2_id limit 2; drop table t1,t2; # @@ -687,7 +687,7 @@ drop table t1, t2, t3; # BUG#14940 {Wrong query plan is chosen because of odd results of # prev_record_reads() function } -create table t1 (a int); +create table t1 (a int) engine=myisam; insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t2 (a int, b int, primary key(a)); @@ -699,12 +699,13 @@ select 'The cost of accessing t1 (dont care if it changes' '^'; select 'vv: Following query must use ALL(t1), eq_ref(A), eq_ref(B): vv' Z; +select @@myisam.optimizer_disk_read_ratio; +set global myisam.optimizer_disk_read_ratio=0; explain select * from t1, t2 A, t2 B where A.a = t1.a and B.a=A.b; show status like 'Last_query_cost'; -select '^^: The above should be ~= 20 + cost(select * from t1). Value less than 20 is an error' Z; - - - +select '^^: The above should be ~= 40 + cost(select * from t1). Value less than 40 is an error' Z; +set global myisam.optimizer_disk_read_ratio=default; +select @@myisam.optimizer_disk_read_ratio; drop table t1, t2; # @@ -959,6 +960,9 @@ INSERT INTO t1 VALUES (3,'b'),(4,NULL),(5,'c'),(6,'cc'),(7,'d'), (8,'dd'),(9,'e'),(10,'ee'); INSERT INTO t2 VALUES (2,NULL); ANALYZE TABLE t1,t2; +# This will ensure that status tables are read now and not part of the later +# Handler_read% counts +explain SELECT * FROM t1 JOIN t2 ON t1.v = t2.v WHERE t2.v IS NULL ORDER BY 1; FLUSH STATUS; --disable_ps2_protocol SELECT * FROM t1 JOIN t2 ON t1.v = t2.v WHERE t2.v IS NULL ORDER BY 1; @@ -1904,3 +1908,20 @@ SELECT * FROM SET OPTIMIZER_USE_CONDITION_SELECTIVITY=@tmp; DROP TABLE t1,t2; --echo # End of 10.6 tests + +--echo # +--echo # MDEV-30256 Wrong result (missing rows) upon join with empty table +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (3),(4); +CREATE TABLE t3 (c INT PRIMARY KEY); +EXPLAIN SELECT * FROM t1 LEFT JOIN t2 JOIN t3 ON (t2.b >= t3.c) ON (t1.a < t2.b); +SELECT * FROM t1 LEFT JOIN t2 JOIN t3 ON (t2.b >= t3.c) ON (t1.a < t2.b); +DROP TABLE t1,t2,t3; + +--echo # +--echo # End of 11.0 tests +--echo # |