List:Commits« Previous MessageNext Message »
From:ramil Date:April 24 2006 9:46am
Subject:bk commit into 5.0 tree (ramil:1.2106)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of ram. When ram 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
  1.2106 06/04/24 12:46:04 ramil@stripped +3 -0
  Merge mysql.com:/usr/home/ram/work/mysql-4.1
  into  mysql.com:/usr/home/ram/work/mysql-5.0

  mysql-test/r/case.result
    1.25 06/04/24 12:45:58 ramil@stripped +8 -8
    merging

  sql/item_cmpfunc.cc
    1.200 06/04/24 12:44:12 ramil@stripped +0 -0
    Auto merged

  mysql-test/t/case.test
    1.19 06/04/24 12:44:12 ramil@stripped +0 -0
    Auto merged

# 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:	ramil
# Host:	myoffice.izhnet.ru
# Root:	/usr/home/ram/work/mysql-5.0/RESYNC

--- 1.199/sql/item_cmpfunc.cc	2006-04-11 22:03:30 +05:00
+++ 1.200/sql/item_cmpfunc.cc	2006-04-24 12:44:12 +05:00
@@ -41,10 +41,25 @@ static Item_result item_store_type(Item_
 
 static void agg_result_type(Item_result *type, Item **items, uint nitems)
 {
-  uint i;
-  type[0]= items[0]->result_type();
-  for (i=1 ; i < nitems ; i++)
-    type[0]= item_store_type(type[0], items[i]->result_type());
+  Item **item, **item_end;
+
+  *type= STRING_RESULT;
+  /* Skip beginning NULL items */
+  for (item= items, item_end= item + nitems; item < item_end; item++)
+  {
+    if ((*item)->type() != Item::NULL_ITEM)
+    {
+      *type= (*item)->result_type();
+      item++;
+      break;
+    }
+  }
+  /* Combine result types. Note: NULL items don't affect the result */
+  for (; item < item_end; item++)
+  {
+    if ((*item)->type() != Item::NULL_ITEM)
+      *type= item_store_type(type[0], (*item)->result_type());
+  }
 }
 
 

--- 1.24/mysql-test/r/case.result	2005-09-27 20:07:20 +05:00
+++ 1.25/mysql-test/r/case.result	2006-04-24 12:45:58 +05:00
@@ -192,3 +192,11 @@ CEMPNUM	EMPMUM1	EMPNUM2
 0.00	0	0.00
 2.00	2	NULL
 DROP TABLE t1,t2;
+create table t1(a float, b int default 3);
+insert into t1 (a) values (2), (11), (8);
+select min(a), min(case when 1=1 then a else NULL end),
+min(case when 1!=1 then NULL else a end) 
+from t1 where b=3 group by b;
+min(a)	min(case when 1=1 then a else NULL end)	min(case when 1!=1 then NULL else a end)
+2	2	2
+drop table t1;

--- 1.18/mysql-test/t/case.test	2005-07-28 19:09:48 +05:00
+++ 1.19/mysql-test/t/case.test	2006-04-24 12:44:12 +05:00
@@ -122,6 +122,17 @@ SELECT 'case+union+test'
 UNION 
 SELECT CASE '1' WHEN '2' THEN 'BUG' ELSE 'nobug' END;
 
+#
+# Bug #17896: problem with MIN(CASE...)
+#
+
+create table t1(a float, b int default 3);
+insert into t1 (a) values (2), (11), (8);
+select min(a), min(case when 1=1 then a else NULL end),
+  min(case when 1!=1 then NULL else a end) 
+from t1 where b=3 group by b;
+drop table t1;
+
 # End of 4.1 tests
 
 
Thread
bk commit into 5.0 tree (ramil:1.2106)ramil24 Apr