List:Commits« Previous MessageNext Message »
From:Evgeny Potemkin Date:February 23 2011 2:37pm
Subject:bzr commit into mysql-trunk branch (epotemkin:3005) Bug#11791649
View as plain text  
#At file:///work/bzrroot/wl5274-next-mr-bugfixing/ based on revid:epotemkin@stripped

 3005 Evgeny Potemkin	2011-02-23
      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-21 16:28:03 +0000
+++ b/mysql-test/r/derived.result	2011-02-23 14:37:35 +0000
@@ -1515,3 +1515,46 @@ c	4
 m	6
 DROP TABLE t1,t2,t3;
 #
+#
+# Bug#11791649 - ASSERT: FIXED == 0, IN ITEM.CC ON EXPLAIN WITH VIEW
+#                IN SUBQUERY 
+#
+CREATE TABLE t1 (  
+pk int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (pk)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
+(11),(12),(13),(14),(15),(16),(17),(18),(19),(20)
+;
+CREATE TABLE t2 (
+pk INT NOT NULL AUTO_INCREMENT,
+col_int_key INT,
+col_varchar_key varchar(1),
+col_varchar_nokey varchar(1),
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_varchar_key (col_varchar_key)
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (2, 9, 'm', 'm');
+CREATE VIEW view1 AS
+SELECT t2.col_varchar_key AS col_varchar_key,
+COUNT(col_varchar_nokey) AS `COUNT( col_varchar_nokey )`
+         FROM t2
+WHERE (2,4) IN (SELECT t2.col_int_key, t2.pk)
+;
+EXPLAIN SELECT pk
+FROM t1
+WHERE ( 'd' , 'f' ) IN
+( SELECT *
+FROM view1
+)
+;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+2	DEPENDENT SUBQUERY	<derived3>	index_subquery	auto_key0	auto_key0	12	const,const	0	Using index; Using where
+3	DERIVED	t2	ALL	NULL	NULL	NULL	NULL	1	Using where
+4	DEPENDENT SUBQUERY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+DROP VIEW view1;
+DROP TABLE t1,t2;
+#

=== modified file 'mysql-test/t/derived.test'
--- a/mysql-test/t/derived.test	2011-02-21 16:28:03 +0000
+++ b/mysql-test/t/derived.test	2011-02-23 14:37:35 +0000
@@ -871,3 +871,48 @@ WHERE (field1, field2) IN (
 DROP TABLE t1,t2,t3;
 --echo #
 
+--echo #
+--echo # Bug#11791649 - ASSERT: FIXED == 0, IN ITEM.CC ON EXPLAIN WITH VIEW
+--echo #                IN SUBQUERY 
+--echo #
+CREATE TABLE t1 (  
+  pk int(11) NOT NULL AUTO_INCREMENT,
+  PRIMARY KEY (pk)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+  (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
+  (11),(12),(13),(14),(15),(16),(17),(18),(19),(20)
+;
+
+CREATE TABLE t2 (
+  pk INT NOT NULL AUTO_INCREMENT,
+  col_int_key INT,
+  col_varchar_key varchar(1),
+  col_varchar_nokey varchar(1),
+  PRIMARY KEY (pk),
+  KEY col_int_key (col_int_key),
+  KEY col_varchar_key (col_varchar_key)
+) ENGINE=InnoDB;
+
+INSERT INTO t2 VALUES (2, 9, 'm', 'm');
+
+CREATE VIEW view1 AS
+  SELECT t2.col_varchar_key AS col_varchar_key,
+         COUNT(col_varchar_nokey) AS `COUNT( col_varchar_nokey )`
+         FROM t2
+         WHERE (2,4) IN (SELECT t2.col_int_key, t2.pk)
+;
+
+EXPLAIN SELECT pk
+FROM t1
+WHERE ( 'd' , 'f' ) IN
+  ( SELECT *
+     FROM view1
+  )
+; 
+
+DROP VIEW view1;
+DROP TABLE t1,t2;
+--echo #
+

=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc	2011-02-21 14:17:57 +0000
+++ b/sql/item_subselect.cc	2011-02-23 14:37:35 +0000
@@ -2634,9 +2634,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)
+      err|= mysql_handle_single_derived(table->in_use->lex, tl,
+                                        mysql_derived_cleanup);
     if (err)
       DBUG_RETURN(1);
   }
@@ -2754,9 +2755,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)
+      err|= 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-21 16:28:03 +0000
+++ b/sql/sql_select.cc	2011-02-23 14:37:35 +0000
@@ -18514,8 +18514,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=


Attachment: [text/bzr-bundle] bzr/epotemkin@mysql.com-20110223143735-vhfyl0h8w1abo553.bundle
Thread
bzr commit into mysql-trunk branch (epotemkin:3005) Bug#11791649Evgeny Potemkin23 Feb
  • Re: bzr commit into mysql-trunk branch (epotemkin:3005) Bug#11791649Øystein Grøvlen24 Feb