List:Commits« Previous MessageNext Message »
From:eugene Date:September 15 2006 4:03pm
Subject:bk commit into 5.0 tree (evgen:1.2253) BUG#20825
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen 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, 2006-09-15 20:03:49+04:00, evgen@stripped +3 -0
  Fixed bug#20825: rollup puts non-equal values together
  
  Fix for bug 7894 replaces a field in a non-aggregate function with a item
  reference if such a field was specified in the GROUP BY clause in order to
  get a correct result.
  When ROLLUP is involved this lead to a wrong result due to value of a such
  field is got through a copy function and copying happens after the function
  evaluation.
  Such replacement isn't needed if that field is also specified in the select
  list.
  
  The change_group_ref() function now doesn't substitute a field with a
  reference if the field is specified in the select list.

  mysql-test/r/olap.result@stripped, 2006-09-15 20:02:22+04:00, evgen@stripped +9 -0
    Added the test case for bug#20825: rollup puts non-equal values together

  mysql-test/t/olap.test@stripped, 2006-09-15 20:01:52+04:00, evgen@stripped +8 -0
    Added the test case for bug#20825: rollup puts non-equal values together

  sql/sql_select.cc@stripped, 2006-09-15 20:02:39+04:00, evgen@stripped +1 -1
    Fixed bug#20825: rollup puts non-equal values together
    The change_group_ref() function now doesn't substitute a field with a
    reference if the field is specified in the select list.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	evgen
# Host:	moonbone.local
# Root:	/work/20825-bug-5.0-opt-mysql

--- 1.447/sql/sql_select.cc	2006-09-15 20:03:54 +04:00
+++ 1.448/sql/sql_select.cc	2006-09-15 20:03:54 +04:00
@@ -13730,7 +13730,7 @@
         ORDER *group_tmp;
         for (group_tmp= group_list; group_tmp; group_tmp= group_tmp->next)
         {
-          if (item->eq(*group_tmp->item,0))
+          if (item->eq(*group_tmp->item,0) && !group_tmp->counter_used)
           {
             Item *new_item;
             if (!(new_item= new Item_ref(context, group_tmp->item, 0,

--- 1.33/mysql-test/r/olap.result	2006-09-15 20:03:54 +04:00
+++ 1.34/mysql-test/r/olap.result	2006-09-15 20:03:54 +04:00
@@ -630,3 +630,12 @@
 NULL	NULL	2
 DROP VIEW v1;
 DROP TABLE t1;
+create table t1 (a varchar(22) not null , b int);
+insert into t1 values ("2006-07-01 21:30", 1), ("2006-07-01 23:30", 10);
+select left(a,10), a, sum(b) from t1 group by 1,2 with rollup;
+left(a,10)	a	sum(b)
+2006-07-01	2006-07-01 21:30	1
+2006-07-01	2006-07-01 23:30	10
+2006-07-01	NULL	11
+NULL	NULL	11
+drop table t1;

--- 1.25/mysql-test/t/olap.test	2006-09-15 20:03:54 +04:00
+++ 1.26/mysql-test/t/olap.test	2006-09-15 20:03:54 +04:00
@@ -319,3 +319,11 @@
 DROP VIEW v1;
 DROP TABLE t1;
 # End of 4.1 tests
+
+#
+# Bug #20825: rollup puts non-equal values together
+#
+create table t1 (a varchar(22) not null , b int);
+insert into t1 values ("2006-07-01 21:30", 1), ("2006-07-01 23:30", 10);
+select left(a,10), a, sum(b) from t1 group by 1,2 with rollup;
+drop table t1;
Thread
bk commit into 5.0 tree (evgen:1.2253) BUG#20825eugene15 Sep