#At file:///work/bzrroot/11791649-bug/ based on revid:epotemkin@stripped
3002 Evgeny Potemkin 2011-05-28
Bug#11791649 - ASSERT: FIXED == 0, IN ITEM.CC ON EXPLAIN WITH VIEW IN SUBQUERY
The mysql_derived_cleanup function was mistakenly called for EXPLAIN causing
materializable view to be prepared for the second time and thus throwing the
reported assertion.
Fixed by skipping immediate cleanup in case of EXPLAIN.
@ mysql-test/r/derived.result
Added a test case for the bug#11791649.
@ mysql-test/t/derived.test
Added a test case for the bug#11791649.
@ sql/item_subselect.cc
Bug#11791649 - ASSERT: FIXED == 0, IN ITEM.CC ON EXPLAIN WITH VIEW IN SUBQUERY
subselect_uniquesubquery_engine::exec and subselect_indexsubquery_engine::exec
functions now don't call cleanup function immediately for EXPLAIN queries.
@ sql/sql_select.cc
Bug#11791649 - ASSERT: FIXED == 0, IN ITEM.CC ON EXPLAIN WITH VIEW IN SUBQUERY
join_materialize_table function now doesn't call cleanup for EXPLAIN queries.
modified:
mysql-test/r/derived.result
mysql-test/t/derived.test
sql/item_subselect.cc
sql/sql_select.cc
=== modified file 'mysql-test/r/derived.result'
--- a/mysql-test/r/derived.result 2011-02-17 12:14:26 +0000
+++ b/mysql-test/r/derived.result 2011-05-28 10:48:53 +0000
@@ -1328,3 +1328,24 @@ f1 f11 f2 f22 f3 f33
DROP TABLE t1,t2,t3;
DROP VIEW v1,v2,v3,v4,v6,v7;
#
+#
+# Bug#11791649 - ASSERT: FIXED == 0, IN ITEM.CC ON EXPLAIN WITH VIEW
+# IN SUBQUERY
+#
+CREATE TABLE t1 (pk int);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (col_varchar_nokey varchar(1));
+INSERT INTO t2 VALUES ('m'), ('f');
+EXPLAIN SELECT pk
+FROM t1
+WHERE (2) IN
+( SELECT *
+FROM (SELECT COUNT(col_varchar_nokey) FROM t2) d
+)
+;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+2 DEPENDENT SUBQUERY <derived3> ref auto_key0 auto_key0 8 const 0 Using where; Using index
+3 DERIVED t2 ALL NULL NULL NULL NULL 2
+DROP TABLE t1,t2;
+#
=== modified file 'mysql-test/t/derived.test'
--- a/mysql-test/t/derived.test 2011-02-17 12:14:26 +0000
+++ b/mysql-test/t/derived.test 2011-05-28 10:48:53 +0000
@@ -693,3 +693,23 @@ DROP VIEW v1,v2,v3,v4,v6,v7;
--echo #
+--echo #
+--echo # Bug#11791649 - ASSERT: FIXED == 0, IN ITEM.CC ON EXPLAIN WITH VIEW
+--echo # IN SUBQUERY
+--echo #
+CREATE TABLE t1 (pk int);
+INSERT INTO t1 VALUES (1);
+
+CREATE TABLE t2 (col_varchar_nokey varchar(1));
+INSERT INTO t2 VALUES ('m'), ('f');
+
+EXPLAIN SELECT pk
+FROM t1
+WHERE (2) IN
+ ( SELECT *
+ FROM (SELECT COUNT(col_varchar_nokey) FROM t2) d
+ )
+;
+DROP TABLE t1,t2;
+--echo #
+
=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc 2011-02-18 10:46:59 +0000
+++ b/sql/item_subselect.cc 2011-05-28 10:48:53 +0000
@@ -2618,9 +2618,10 @@ int subselect_uniquesubquery_engine::exe
bool err= mysql_handle_single_derived(table->in_use->lex, tl,
mysql_derived_create) ||
mysql_handle_single_derived(table->in_use->lex, tl,
- mysql_derived_materialize) ||
- mysql_handle_single_derived(table->in_use->lex, tl,
- mysql_derived_cleanup);
+ mysql_derived_materialize);
+ if (!tab->table->in_use->lex->describe)
+ mysql_handle_single_derived(table->in_use->lex, tl,
+ mysql_derived_cleanup);
if (err)
DBUG_RETURN(1);
}
@@ -2738,9 +2739,10 @@ int subselect_indexsubquery_engine::exec
bool err= mysql_handle_single_derived(table->in_use->lex, tl,
mysql_derived_create) ||
mysql_handle_single_derived(table->in_use->lex, tl,
- mysql_derived_materialize) ||
- mysql_handle_single_derived(table->in_use->lex, tl,
- mysql_derived_cleanup);
+ mysql_derived_materialize);
+ if (!tab->table->in_use->lex->describe)
+ mysql_handle_single_derived(table->in_use->lex, tl,
+ mysql_derived_cleanup);
if (err)
DBUG_RETURN(1);
}
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2011-02-17 12:14:26 +0000
+++ b/sql/sql_select.cc 2011-05-28 10:48:53 +0000
@@ -18513,8 +18513,9 @@ join_materialize_table(JOIN_TAB *tab)
!derived->materialized);
bool res= mysql_handle_single_derived(tab->table->in_use->lex,
derived, &mysql_derived_materialize);
- mysql_handle_single_derived(tab->table->in_use->lex,
- derived, &mysql_derived_cleanup);
+ if (!tab->table->in_use->lex->describe)
+ mysql_handle_single_derived(tab->table->in_use->lex,
+ derived, &mysql_derived_cleanup);
if (res)
return -1;
tab->read_first_record= tab->save_read_first_record;
Attachment: [text/bzr-bundle] bzr/evgeny.potemkin@oracle.com-20110528104853-ur50qm3u02t1m3mz.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk branch (evgeny.potemkin:3002) Bug#11791649 | Evgeny Potemkin | 31 May |