List:Commits« Previous MessageNext Message »
From:Mattias Jonsson Date:January 21 2011 10:12am
Subject:bzr commit into mysql-trunk branch (mattias.jonsson:3532) Bug#59503
View as plain text  
#At file:///C:/mysql-bzr/b59503-trunk/ based on revid:anders.song@stripped

 3532 Mattias Jonsson	2011-01-21
      bug#59503: explain extended crash in get_mm_leaf
      
      The problem was during partitioning pruning.
      Partitioning pruning does not use any real indexes
      (instead uses the partitioning function)
      so one must check if real indexes is in use before trying to
      reference them.

    modified:
      mysql-test/r/partition.result
      mysql-test/t/partition.test
      sql/opt_range.cc
=== modified file 'mysql-test/r/partition.result'
--- a/mysql-test/r/partition.result	2011-01-10 16:37:47 +0000
+++ b/mysql-test/r/partition.result	2011-01-21 10:12:05 +0000
@@ -1,5 +1,18 @@
 drop table if exists t1, t2;
 #
+# Bug#59503: explain extended crash in get_mm_leaf
+#
+CREATE TABLE t1 (a VARCHAR(51) CHARACTER SET latin1)
+ENGINE=MyISAM
+PARTITION BY KEY (a) PARTITIONS 1;
+INSERT INTO t1 VALUES ('a'),('b'),('c');
+EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a > 1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where
+Warnings:
+Note	1003	select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`a` > 1)
+DROP TABLE t1;
+#
 # Bug#57778: failed primary key add to partitioned innodb table
 #            inconsistent and crashes
 #

=== modified file 'mysql-test/t/partition.test'
--- a/mysql-test/t/partition.test	2011-01-10 16:37:47 +0000
+++ b/mysql-test/t/partition.test	2011-01-21 10:12:05 +0000
@@ -15,6 +15,16 @@ drop table if exists t1, t2;
 --enable_warnings
 
 --echo #
+--echo # Bug#59503: explain extended crash in get_mm_leaf
+--echo #
+CREATE TABLE t1 (a VARCHAR(51) CHARACTER SET latin1)
+ENGINE=MyISAM
+PARTITION BY KEY (a) PARTITIONS 1;
+INSERT INTO t1 VALUES ('a'),('b'),('c');
+EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a > 1;
+DROP TABLE t1;
+
+--echo #
 --echo # Bug#57778: failed primary key add to partitioned innodb table
 --echo #            inconsistent and crashes
 --echo #

=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc	2010-12-29 00:38:59 +0000
+++ b/sql/opt_range.cc	2011-01-21 10:12:05 +0000
@@ -692,7 +692,8 @@ public:
   /* 
     If true, the index descriptions describe real indexes (and it is ok to
     call field->optimize_range(real_keynr[...], ...).
-    Otherwise index description describes fake indexes.
+    Otherwise index description describes fake indexes, like a partitioning
+    expression.
   */
   bool using_real_indexes;
   
@@ -5774,7 +5775,8 @@ get_mm_leaf(RANGE_OPT_PARAM *param, Item
       !(conf_func->compare_collation()->state & MY_CS_BINSORT &&
         (type == Item_func::EQUAL_FUNC || type == Item_func::EQ_FUNC)))
   {
-    if (param->thd->lex->describe & DESCRIBE_EXTENDED)
+    if (param->using_real_indexes &&
+        param->thd->lex->describe & DESCRIBE_EXTENDED)
       push_warning_printf(
               param->thd,
               MYSQL_ERROR::WARN_LEVEL_WARN, 
@@ -5906,7 +5908,8 @@ get_mm_leaf(RANGE_OPT_PARAM *param, Item
       value->result_type() != STRING_RESULT &&
       field->cmp_type() != value->result_type())
   {
-    if (param->thd->lex->describe & DESCRIBE_EXTENDED)
+    if (param->using_real_indexes &&
+        param->thd->lex->describe & DESCRIBE_EXTENDED)
       push_warning_printf(
               param->thd,
               MYSQL_ERROR::WARN_LEVEL_WARN, 


Attachment: [text/bzr-bundle] bzr/mattias.jonsson@oracle.com-20110121101205-4cbiiyv3ktixl7jg.bundle
Thread
bzr commit into mysql-trunk branch (mattias.jonsson:3532) Bug#59503Mattias Jonsson21 Jan