summaryrefslogtreecommitdiff
path: root/mysql-test/t/join_cache.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2010-03-06 11:14:55 -0800
committerIgor Babaev <igor@askmonty.org>2010-03-06 11:14:55 -0800
commit1c7ba7ba2f1daeeeb6ab507c4ee3209690119c51 (patch)
treee5ccb7d7fa53b11a79d8e4d97497fb71935b2316 /mysql-test/t/join_cache.test
parent3ccc1d6b1ef22323546a30dd73c12898537f3d7d (diff)
downloadmariadb-git-1c7ba7ba2f1daeeeb6ab507c4ee3209690119c51.tar.gz
Fixed bug #51092.
The function JOIN_CACHE::read_all_record_fields could return 0 for an incremental join cache in two cases: 1. there were no more records in the associated join buffer 2. there was no table fields stored in the join buffer. As a result the function JOIN_CACHE::get_record() could return prematurely and did not read all needed fields from join buffers into the record buffer. Now the function JOIN_CACHE::read_all_record_fields returns -1 if there are no more records in the associated join buffer.
Diffstat (limited to 'mysql-test/t/join_cache.test')
-rw-r--r--mysql-test/t/join_cache.test24
1 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/t/join_cache.test b/mysql-test/t/join_cache.test
index 82fc37db641..0cb1c139161 100644
--- a/mysql-test/t/join_cache.test
+++ b/mysql-test/t/join_cache.test
@@ -1823,3 +1823,27 @@ SELECT t1.*, t2.*, LENGTH(t2.c1), LENGTH(t2.c2) FROM t1,t2
set join_cache_level=default;
DROP TABLE t1,t2;
+
+--echo #
+--echo # Bug #51092: linked join buffer is used for a 3-way cross join query
+--echo # that selects only records of the first table
+--echo #
+
+create table t1 (a int, b int);
+insert into t1 values (1,1),(2,2);
+create table t2 (a int, b int);
+insert into t2 values (1,1),(2,2);
+create table t3 (a int, b int);
+insert into t3 values (1,1),(2,2);
+
+explain select t1.* from t1,t2,t3;
+select t1.* from t1,t2,t3;
+
+set join_cache_level=2;
+
+explain select t1.* from t1,t2,t3;
+select t1.* from t1,t2,t3;
+
+set join_cache_level=default;
+
+drop table t1,t2,t3;