MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Olav Sandstaa Date:July 8 2010 1:37pm
Subject:bzr commit into mysql-next-mr-bugfixing branch (olav:3295) Bug#54515
View as plain text  
#At file:///export/home/tmp/mysql/bug54515-next-mr/ based on revid:guilhem@stripped

 3295 Olav Sandstaa	2010-07-08 [merge]
      Merging fix for Bug#54515 from mysql-trunk-bugfixing to mysql-next-mr-bugfixing.

    modified:
      mysql-test/r/select.result
      mysql-test/t/select.test
      sql/opt_range.cc
=== modified file 'mysql-test/r/select.result'

=== modified file 'mysql-test/r/select.result'
--- a/mysql-test/r/select.result	2010-04-29 20:33:06 +0000
+++ b/mysql-test/r/select.result	2010-07-08 13:19:05 +0000
@@ -4857,3 +4857,22 @@
 a	b	c
 DROP TABLE t1;
 End of 5.1 tests
+#
+# Bug#54515: Crash in opt_range.cc::get_best_group_min_max on 
+#            SELECT from VIEW with GROUP BY
+#
+CREATE TABLE t1 (
+col_int_key int DEFAULT NULL,
+KEY int_key (col_int_key)
+) ;
+INSERT INTO t1 VALUES (1),(2);
+CREATE VIEW view_t1 AS 
+SELECT t1.col_int_key AS col_int_key
+FROM t1;
+SELECT col_int_key FROM view_t1 GROUP BY col_int_key;
+col_int_key
+1
+2
+DROP VIEW view_t1;
+DROP TABLE t1;
+# End of test BUG#54515

=== modified file 'mysql-test/t/select.test'
--- a/mysql-test/t/select.test	2010-04-29 20:33:06 +0000
+++ b/mysql-test/t/select.test	2010-07-08 13:19:05 +0000
@@ -4118,3 +4118,26 @@
 
 
 --echo End of 5.1 tests
+
+--echo #
+--echo # Bug#54515: Crash in opt_range.cc::get_best_group_min_max on 
+--echo #            SELECT from VIEW with GROUP BY
+--echo #
+
+CREATE TABLE t1 (
+  col_int_key int DEFAULT NULL,
+  KEY int_key (col_int_key)
+) ;
+
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE VIEW view_t1 AS 
+  SELECT t1.col_int_key AS col_int_key
+  FROM t1;
+
+SELECT col_int_key FROM view_t1 GROUP BY col_int_key;
+
+DROP VIEW view_t1;
+DROP TABLE t1;
+
+--echo # End of test BUG#54515

=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc	2010-07-02 02:58:51 +0000
+++ b/sql/opt_range.cc	2010-07-08 13:37:14 +0000
@@ -9570,8 +9570,8 @@
           first Item? If so, then why? What is the array for?
         */
         /* Above we already checked that all group items are fields. */
-        DBUG_ASSERT((*tmp_group->item)->type() == Item::FIELD_ITEM);
-        Item_field *group_field= (Item_field *) (*tmp_group->item);
+        DBUG_ASSERT((*tmp_group->item)->real_item()->type() == Item::FIELD_ITEM);
+        Item_field *group_field= (Item_field *) (*tmp_group->item)->real_item();
         if (group_field->field->eq(cur_part->field))
         {
           cur_group_prefix_len+= cur_part->store_length;


Attachment: [text/bzr-bundle] bzr/olav@sun.com-20100708133714-p13y68iq272ulqp5.bundle
Thread
bzr commit into mysql-next-mr-bugfixing branch (olav:3295) Bug#54515Olav Sandstaa8 Jul