List:Commits« Previous MessageNext Message »
From:eugene Date:March 6 2007 7:40pm
Subject:bk commit into 5.0 tree (evgen:1.2431) BUG#25376
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, 2007-03-06 21:40:47+03:00, evgen@stripped +3 -0
  Bug#25376: Incomplete setup of ORDER BY clause results in a wrong result.
  
  Functions over sum functions wasn't set up correctly for the ORDER BY clause
  which leads to a wrong order of the result set.
  
  The find_order_in_list() function now calls split_sum_func() function for
  the ORDER BY item being fixed to setup sum functions.

  mysql-test/r/order_by.result@stripped, 2007-03-06 21:39:25+03:00, evgen@stripped +9 -0
    Added a test case for bug#25376: Incomplete setup of ORDER BY clause results in a
wrong result.

  mysql-test/t/order_by.test@stripped, 2007-03-06 21:39:13+03:00, evgen@stripped +9 -0
    Added a test case for bug#25376: Incomplete setup of ORDER BY clause results in a
wrong result.

  sql/sql_select.cc@stripped, 2007-03-06 21:39:58+03:00, evgen@stripped +2 -0
    Bug#25376: Incomplete setup of ORDER BY clause results in a wrong result.
    The find_order_in_list() function now calls split_sum_func() function for
    the ORDER BY item being fixed to setup sum functions.

# 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:	/mnt/gentoo64/work/25376-bug-5.0-opt-mysql

--- 1.495/sql/sql_select.cc	2007-02-27 11:37:15 +03:00
+++ 1.496/sql/sql_select.cc	2007-03-06 21:39:58 +03:00
@@ -13275,6 +13275,8 @@
     return TRUE; /* Wrong field. */
   }
   thd->lex->current_select->is_item_list_lookup= 0;
+  if (order_item->with_sum_func && order_item->type() !=
Item::SUM_FUNC_ITEM)
+    order_item->split_sum_func(thd, ref_pointer_array, all_fields);
 
   uint el= all_fields.elements;
   all_fields.push_front(order_item); /* Add new field to field list. */

--- 1.59/mysql-test/r/order_by.result	2007-01-10 19:55:54 +03:00
+++ 1.60/mysql-test/r/order_by.result	2007-03-06 21:39:25 +03:00
@@ -926,3 +926,12 @@
 2
 3
 DROP TABLE t1,t2,t3,t4;
+select a,(sum(b)/sum(c)) as ratio from
+(select 1 as a, 2 as b, 3 as c union
+select 9,8,3 union select 19,4,3 union
+select 1,4,9) as totals
+group by a order by sum(b)/sum(c) asc;
+a	ratio
+1	0.5000
+19	1.3333
+9	2.6667

--- 1.42/mysql-test/t/order_by.test	2007-01-10 19:55:54 +03:00
+++ 1.43/mysql-test/t/order_by.test	2007-03-06 21:39:13 +03:00
@@ -640,3 +640,12 @@
 ON (t1.a=t2.a AND t1.b=t3.b) order by t2.b;
 
 DROP TABLE t1,t2,t3,t4;
+
+#
+# Bug#25376: Incomplete setup of ORDER BY clause results in a wrong result.
+#
+select a,(sum(b)/sum(c)) as ratio from
+  (select 1 as a, 2 as b, 3 as c union
+   select 9,8,3 union select 19,4,3 union
+   select 1,4,9) as totals
+   group by a order by sum(b)/sum(c) asc;
Thread
bk commit into 5.0 tree (evgen:1.2431) BUG#25376eugene6 Mar