summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <malff@lambda.hsd1.co.comcast.net.>2007-11-06 11:31:00 -0700
committerunknown <malff@lambda.hsd1.co.comcast.net.>2007-11-06 11:31:00 -0700
commitaf48b26ed8b369e80968df581cf395c572d35be2 (patch)
tree910c2d2188fd890eea9bd4d41a9fb3cea8adca9a
parentcecc2702126c5eeb7b69770987b4fb32d6e30644 (diff)
parentc33d42eb32c8a244d6e25ffb36a4d98f3e761553 (diff)
downloadmariadb-git-af48b26ed8b369e80968df581cf395c572d35be2.tar.gz
Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into lambda.hsd1.co.comcast.net.:/home/malff/TREE/mysql-5.1-runtime
-rw-r--r--mysql-test/r/group_min_max.result4
-rw-r--r--mysql-test/r/index_merge_myisam.result2
-rw-r--r--mysql-test/r/key.result14
-rw-r--r--mysql-test/t/key.test17
-rw-r--r--sql/sql_select.cc7
5 files changed, 34 insertions, 10 deletions
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index 270f248ea9c..a3744b36e87 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -2251,7 +2251,7 @@ EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
-2 SUBQUERY t1 range NULL a 5 NULL 8
+2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
id select_type table type possible_keys key key_len ref rows Extra
@@ -2268,7 +2268,7 @@ AND t1_outer1.b = t1_outer2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer1 ref a a 5 const 1 Using where; Using index
1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using where; Using index; Using join buffer
-2 SUBQUERY t1 range NULL a 5 NULL 8
+2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2;
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result
index ebeba53fdfa..9d7d06f7f1b 100644
--- a/mysql-test/r/index_merge_myisam.result
+++ b/mysql-test/r/index_merge_myisam.result
@@ -286,7 +286,7 @@ NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
explain select * from (select * from t1 where key1 = 3 or key2 =3) as Z where key8 >5;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
-2 DERIVED t1 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
+2 DERIVED t1 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where; Using index
create table t3 like t0;
insert into t3 select * from t0;
alter table t3 add key9 int not null, add index i9(key9);
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index 6c115435fb6..3db5e926d30 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -545,3 +545,17 @@ c1
1
1
DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, INDEX (a,b));
+INSERT INTO t1 (a, b)
+VALUES
+(1,1), (1,2), (1,3), (1,4), (1,5),
+(2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);
+EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
+(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
+SELECT 1 as RES FROM t1 AS t1_outer WHERE
+(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
+RES
+DROP TABLE t1;
diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test
index cd6c480407d..31d5ac5201b 100644
--- a/mysql-test/t/key.test
+++ b/mysql-test/t/key.test
@@ -524,3 +524,20 @@ ORDER BY (
LIMIT 1);
DROP TABLE t1;
+
+
+#
+# Bug #31974: Wrong EXPLAIN output
+#
+
+CREATE TABLE t1 (a INT, b INT, INDEX (a,b));
+INSERT INTO t1 (a, b)
+ VALUES
+ (1,1), (1,2), (1,3), (1,4), (1,5),
+ (2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);
+EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
+ (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
+SELECT 1 as RES FROM t1 AS t1_outer WHERE
+ (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
+
+DROP TABLE t1;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 338b5f0cc3f..862948e48a4 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -6651,14 +6651,7 @@ void JOIN::cleanup(bool full)
for (tab= join_tab, end= tab+tables; tab != end; tab++)
{
if (tab->table)
- {
- if (tab->table->key_read)
- {
- tab->table->key_read= 0;
- tab->table->file->extra(HA_EXTRA_NO_KEYREAD);
- }
tab->table->file->ha_index_or_rnd_end();
- }
}
}
}