List:Commits« Previous MessageNext Message »
From:Ian Greenhoe Date:September 18 2006 10:00am
Subject:bk commit into 5.0 tree (igreenhoe:1.2272) BUG#17439
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of greenman. When greenman 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-18 03:00:16-07:00, igreenhoe@stripped +4 -0
  Fix for bug #17439 (~0 works different inside functions than the bare
  expression)
  
  Problem: abs() and if() were not checking or using the value of
  unsigned_flag.
  
  Solution: abs() and if() changed appropriately.

  mysql-test/r/func_op.result@stripped, 2006-09-18 03:00:11-07:00, igreenhoe@stripped +6 -0
    New test results

  mysql-test/t/func_op.test@stripped, 2006-09-18 03:00:11-07:00, igreenhoe@stripped +7 -0
    New tests

  sql/item_cmpfunc.cc@stripped, 2006-09-18 03:00:11-07:00, igreenhoe@stripped +1 -0
    Added set of unsigned flag

  sql/item_func.cc@stripped, 2006-09-18 03:00:11-07:00, igreenhoe@stripped +1 -1
    Added check of unsigned flag

# 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:	igreenhoe
# Host:	anubis.greendragongames.com
# Root:	/home/greenman/workspace-mysql/mysql/bug-5.0-17439

--- 1.217/sql/item_cmpfunc.cc	2006-09-18 03:00:25 -07:00
+++ 1.218/sql/item_cmpfunc.cc	2006-09-18 03:00:25 -07:00
@@ -1557,6 +1557,7 @@
   Item *arg= args[0]->val_bool() ? args[1] : args[2];
   longlong value=arg->val_int();
   null_value=arg->null_value;
+  unsigned_flag= arg->unsigned_flag;
   return value;
 }
 

--- 1.300/sql/item_func.cc	2006-09-18 03:00:25 -07:00
+++ 1.301/sql/item_func.cc	2006-09-18 03:00:25 -07:00
@@ -1405,7 +1405,7 @@
 {
   longlong value= args[0]->val_int();
   null_value= args[0]->null_value;
-  return value >= 0 ? value : -value;
+  return (value >= 0 || args[0]->unsigned_flag) ? value : -value;
 }
 
 

--- 1.11/mysql-test/r/func_op.result	2006-09-18 03:00:25 -07:00
+++ 1.12/mysql-test/r/func_op.result	2006-09-18 03:00:25 -07:00
@@ -46,3 +46,9 @@
 2	NULL	NULL	NULL
 3	3	7	3
 drop table t1, t2;
+select ~0, abs(~0), if (true, ~0, 0);
+~0	abs(~0)	if (true, ~0, 0)
+18446744073709551615	18446744073709551615	18446744073709551615
+select 18446744073709551615, abs(18446744073709551615), if (true, 18446744073709551615, 0);
+18446744073709551615	abs(18446744073709551615)	if (true, 18446744073709551615, 0)
+18446744073709551615	18446744073709551615	18446744073709551615

--- 1.8/mysql-test/t/func_op.test	2006-09-18 03:00:25 -07:00
+++ 1.9/mysql-test/t/func_op.test	2006-09-18 03:00:25 -07:00
@@ -32,3 +32,10 @@
 drop table t1, t2;
 
 # End of 4.1 tests
+
+# bug #17439 - ~ works different inside of functions than the bare expression
+
+select ~0, abs(~0), if (true, ~0, 0);
+select 18446744073709551615, abs(18446744073709551615), if (true, 18446744073709551615, 0);
+
+
Thread
bk commit into 5.0 tree (igreenhoe:1.2272) BUG#17439Ian Greenhoe18 Sep