diff options
author | holyfoot/hf@hfmain.(none) <> | 2007-04-29 13:19:32 +0500 |
---|---|---|
committer | holyfoot/hf@hfmain.(none) <> | 2007-04-29 13:19:32 +0500 |
commit | 2fcebef31fbde737d9a7154b842bbd2c5efbaa92 (patch) | |
tree | edfad9e83a97b7f6eef66878ef43a7c0cf00d858 /mysql-test/r/join.result | |
parent | 29970f1e0d909b209b5f99b0bca2193e67cd707e (diff) | |
parent | 90864c2874917bca8794b71981c57263368b573a (diff) | |
download | mariadb-git-2fcebef31fbde737d9a7154b842bbd2c5efbaa92.tar.gz |
Merge mysql.com:/d2/hf/mrg/mysql-5.0-opt
into mysql.com:/d2/hf/mrg/mysql-5.1-opt
Diffstat (limited to 'mysql-test/r/join.result')
-rw-r--r-- | mysql-test/r/join.result | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index 0a45aa2eb9b..840a92dcce2 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -764,6 +764,49 @@ natural join t5; y c b a z 1 3 2 1 4 drop table t1, t2, t3, t4, t5; +CREATE TABLE t1 (ID INTEGER, Name VARCHAR(50)); +CREATE TABLE t2 (Test_ID INTEGER); +CREATE VIEW v1 (Test_ID, Description) AS SELECT ID, Name FROM t1; +CREATE TABLE tv1 SELECT Description AS Name FROM v1 JOIN t2 +USING (Test_ID); +DESCRIBE tv1; +Field Type Null Key Default Extra +Name varchar(50) YES NULL +CREATE TABLE tv2 SELECT Description AS Name FROM v1 JOIN t2 +ON v1.Test_ID = t2.Test_ID; +DESCRIBE tv2; +Field Type Null Key Default Extra +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; create table t1 (a int); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t2 (a int, b int, filler char(100), key(a), key(b)); |