MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Alexey Kopytov Date:February 22 2008 8:34am
Subject:bk commit into 5.0 tree (kaa:1.2607) BUG#33049
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kaa.  When kaa 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, 2008-02-22 11:34:18+03:00, kaa@kaamos.(none) +3 -0
  Fix for bug #33049: Assert while running test-as3ap test(mysql-bench 
                      suite)
  
  Under some circumstances a combination of aggregate functions and
  GROUP BY in a SELECT query over a VIEW could lead to incorrect
  calculation of the result type of the aggregate function. This in
  turn could result in incorrect results, or assertion failures on debug
  builds.
  
  Fixed by changing the logic in Item_sum_hybrid::fix_fields() so that
  the argument's item is dereferenced before calling its type() method.

  mysql-test/r/view.result@stripped, 2008-02-22 11:34:17+03:00, kaa@kaamos.(none) +8 -0
    Added a test case for bug #33049.

  mysql-test/t/view.test@stripped, 2008-02-22 11:34:17+03:00, kaa@kaamos.(none) +13 -0
    Added a test case for bug #33049.

  sql/item_sum.cc@stripped, 2008-02-22 11:34:17+03:00, kaa@kaamos.(none) +1 -0
    When calculating the result type of an aggregate function, dereference
    the argument's item before calling its type() method.

diff -Nrup a/mysql-test/r/view.result b/mysql-test/r/view.result
--- a/mysql-test/r/view.result	2008-02-12 12:43:53 +03:00
+++ b/mysql-test/r/view.result	2008-02-22 11:34:17 +03:00
@@ -3634,4 +3634,12 @@ a
 1
 drop view v1, v2;
 drop table t1, t2;
+CREATE TABLE t1 (a INT);
+CREATE VIEW v1 AS SELECT p.a AS a FROM t1 p, t1 q;
+INSERT INTO t1 VALUES (1), (1);
+SELECT MAX(a), COUNT(DISTINCT a) FROM v1 GROUP BY a;
+MAX(a)	COUNT(DISTINCT a)
+1	1
+DROP VIEW v1;
+DROP TABLE t1;
 End of 5.0 tests.
diff -Nrup a/mysql-test/t/view.test b/mysql-test/t/view.test
--- a/mysql-test/t/view.test	2008-02-12 12:43:53 +03:00
+++ b/mysql-test/t/view.test	2008-02-22 11:34:17 +03:00
@@ -3492,5 +3492,18 @@ execute stmt; 
 drop view v1, v2;
 drop table t1, t2;
 
+#
+# Bug #33049: Assert while running test-as3ap test(mysql-bench suite)
+#
+
+CREATE TABLE t1 (a INT);
+CREATE VIEW v1 AS SELECT p.a AS a FROM t1 p, t1 q;
+
+INSERT INTO t1 VALUES (1), (1);
+SELECT MAX(a), COUNT(DISTINCT a) FROM v1 GROUP BY a;
+
+DROP VIEW v1;
+DROP TABLE t1;
+
 --echo End of 5.0 tests.
 
diff -Nrup a/sql/item_sum.cc b/sql/item_sum.cc
--- a/sql/item_sum.cc	2007-12-21 13:44:21 +03:00
+++ b/sql/item_sum.cc	2008-02-22 11:34:17 +03:00
@@ -597,6 +597,7 @@ Item_sum_hybrid::fix_fields(THD *thd, It
   result_field=0;
   null_value=1;
   fix_length_and_dec();
+  item= item->real_item();
   if (item->type() == Item::FIELD_ITEM)
     hybrid_field_type= ((Item_field*) item)->field->type();
   else
Thread
bk commit into 5.0 tree (kaa:1.2607) BUG#33049Alexey Kopytov22 Feb
Re: bk commit into 5.0 tree (kaa:1.2607) BUG#33049Alexey Kopytov22 Feb