Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge 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-25 16:05:09+03:00, gkodinov@stripped +3 -0
Bug #27807:
When creating the temp table structure to
materialize a scalar subquery one of its
members is not set. This causes GPF
in EXPLAIN.
Fixed by seting the pos_in_table_list to
empty and displaying the proper text in
select_describe().
mysql-test/r/subselect.result@stripped, 2007-04-25 16:05:08+03:00, gkodinov@stripped +8 -0
Bug #27807: test case
mysql-test/t/subselect.test@stripped, 2007-04-25 16:05:08+03:00, gkodinov@stripped +9 -0
Bug #27807: test case
sql/sql_select.cc@stripped, 2007-04-25 16:05:08+03:00, gkodinov@stripped +12 -1
Bug #27807:
- set pos_in_table_list for temp tables
- displayed tables without pos_in_table_list
# 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: gkodinov
# Host: magare.gmz
# Root: /home/kgeorge/mysql/work/B27807-5.0-opt
--- 1.511/sql/sql_select.cc 2007-04-21 19:27:34 +03:00
+++ 1.512/sql/sql_select.cc 2007-04-25 16:05:08 +03:00
@@ -9228,6 +9228,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARA
table->quick_keys.init();
table->used_keys.init();
table->keys_in_use_for_query.init();
+ table->pos_in_table_list= NULL;
table->s= &table->share_not_to_be_used;
table->s->blob_field= blob_field;
@@ -14968,9 +14969,19 @@ static void select_describe(JOIN *join,
table->derived_select_number);
item_list.push_back(new Item_string(table_name_buffer, len, cs));
}
+ else if (!table->pos_in_table_list)
+ {
+ /*
+ Table without TABLE_LIST.
+ Usually a temp table result of scalar subquery materialization.
+ */
+ DBUG_ASSERT (table->s->tmp_table);
+ item_list.push_back(new Item_string("<temp_table>",
+ sizeof ("<temp_table>") - 1, cs));
+ }
else
{
- TABLE_LIST *real_table= table->pos_in_table_list;
+ TABLE_LIST *real_table= table->pos_in_table_list;
item_list.push_back(new Item_string(real_table->alias,
strlen(real_table->alias),
cs));
--- 1.185/mysql-test/r/subselect.result 2007-04-20 13:26:57 +03:00
+++ 1.186/mysql-test/r/subselect.result 2007-04-25 16:05:08 +03:00
@@ -4012,3 +4012,11 @@ WHERE (SELECT COUNT(t0.b) FROM t1 t WHER
ERROR HY000: Invalid use of group function
SET @@sql_mode=default;
DROP TABLE t1;
+CREATE TABLE t1 (a int, b int, KEY (a));
+INSERT INTO t1 VALUES (1,1),(2,1);
+EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ref a a 5 const 1 Using where; Using index
+2 SUBQUERY <temp_table> ALL group_key NULL NULL NULL 2 Using where
+DROP TABLE t1;
+End of 5.0 tests.
--- 1.149/mysql-test/t/subselect.test 2007-04-15 08:22:35 +03:00
+++ 1.150/mysql-test/t/subselect.test 2007-04-25 16:05:08 +03:00
@@ -2845,3 +2845,12 @@ SELECT a FROM t1 t0
SET @@sql_mode=default;
DROP TABLE t1;
+
+#
+# Bug #27807: Server crash when executing subquery with EXPLAIN
+#
+CREATE TABLE t1 (a int, b int, KEY (a)); INSERT INTO t1 VALUES (1,1),(2,1);
+EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
+DROP TABLE t1;
+
+--echo End of 5.0 tests.
| Thread |
|---|
| • bk commit into 5.0 tree (gkodinov:1.2440) BUG#27807 | kgeorge | 25 Apr |