Below is the list of changes that have just been committed into a local
4.1 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-29 20:02:53+04:00, evgen@stripped +3 -0
Fixed bug#20825: rollup puts non-equal values together
Fix for bug 7894 replaces a field(s) 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 grouping is also done by such a function.
The change_group_ref() function now isn't called for a function present in
the group list.
mysql-test/r/olap.result@stripped, 2006-09-29 20:02:29+04:00, evgen@stripped +15 -0
Added the test case for the bug#20825: rollup puts non-equal values together
mysql-test/t/olap.test@stripped, 2006-09-29 20:02:28+04:00, evgen@stripped +9 -0
Added the test case for the bug#20825: rollup puts non-equal values together
sql/sql_select.cc@stripped, 2006-09-29 20:02:30+04:00, evgen@stripped +6 -1
Fixed bug#20825: rollup puts non-equal values together
The change_group_ref() function now isn't called for a function present in
the group 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-4.1-opt-mysql
--- 1.459/sql/sql_select.cc 2006-09-29 20:02:56 +04:00
+++ 1.460/sql/sql_select.cc 2006-09-29 20:02:56 +04:00
@@ -9706,12 +9706,17 @@
while ((item= it++))
{
ORDER *group_tmp;
+ bool found_in_group= 0;
+
for (group_tmp= group_list; group_tmp; group_tmp= group_tmp->next)
{
if (*group_tmp->item == item)
+ {
item->maybe_null= 1;
+ found_in_group= 1;
+ }
}
- if (item->type() == Item::FUNC_ITEM)
+ if (item->type() == Item::FUNC_ITEM && !found_in_group)
{
bool changed= FALSE;
if (change_group_ref(thd, (Item_func *) item, group_list, &changed))
--- 1.22/mysql-test/r/olap.result 2006-09-29 20:02:56 +04:00
+++ 1.23/mysql-test/r/olap.result 2006-09-29 20:02:56 +04:00
@@ -541,3 +541,18 @@
NULL 2
a 1
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
+select left(a,10) x, a, sum(b) from t1 group by x,a with rollup;
+x 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.19/mysql-test/t/olap.test 2006-09-29 20:02:56 +04:00
+++ 1.20/mysql-test/t/olap.test 2006-09-29 20:02:56 +04:00
@@ -272,4 +272,13 @@
select distinct a, max(b) from t1 group by a with rollup;
drop table t1;
+#
+# 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;
+select left(a,10) x, a, sum(b) from t1 group by x,a with rollup;
+drop table t1;
+
# End of 4.1 tests
| Thread |
|---|
| • bk commit into 4.1 tree (evgen:1.2553) BUG#20825 | eugene | 29 Sep |