List:Internals« Previous MessageNext Message »
From:ramil Date:November 6 2005 9:35am
Subject:bk commit into 4.0 tree (ramil:1.2174) BUG#13044
View as plain text  
Below is the list of changes that have just been committed into a local
4.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.2174 05/11/06 12:35:49 ramil@stripped +3 -0
  Fix for bug #13044: BIT_COUNT with NULL values.

  sql/item_func.cc
    1.113 05/11/06 12:35:46 ramil@stripped +1 -4
    Fix for bug #13044: BIT_COUNT with NULL values.
    Always set null_value.

  mysql-test/t/func_op.test
    1.5 05/11/06 12:35:46 ramil@stripped +12 -0
    Fix for bug #13044: BIT_COUNT with NULL values.

  mysql-test/r/func_op.result
    1.7 05/11/06 12:35:46 ramil@stripped +11 -0
    Fix for bug #13044: BIT_COUNT with NULL values.

# 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-4.0

--- 1.112/sql/item_func.cc	2005-05-07 15:48:42 +05:00
+++ 1.113/sql/item_func.cc	2005-11-06 12:35:46 +04:00
@@ -1138,11 +1138,8 @@
 longlong Item_func_bit_count::val_int()
 {
   ulonglong value= (ulonglong) args[0]->val_int();
-  if (args[0]->null_value)
-  {
-    null_value=1; /* purecov: inspected */
+  if ((null_value= args[0]->null_value))
     return 0; /* purecov: inspected */
-  }
   return (longlong) my_count_bits(value);
 }
 

--- 1.6/mysql-test/r/func_op.result	2003-12-10 18:30:33 +04:00
+++ 1.7/mysql-test/r/func_op.result	2005-11-06 12:35:46 +04:00
@@ -25,3 +25,14 @@
 select -1 >> 1, -1 << 1;
 -1 >> 1	-1 << 1
 9223372036854775807	18446744073709551614
+drop table if exists t1,t2;
+create table t1(a int);
+create table t2(a int, b int);
+insert into t1 values (1), (2), (3);
+insert into t2 values (1, 7), (3, 7);
+select t1.a, t2.a, t2.b, bit_count(t2.b) from t1 left join t2 on t1.a=t2.a;
+a	a	b	bit_count(t2.b)
+1	1	7	3
+2	NULL	NULL	NULL
+3	3	7	3
+drop table t1, t2;

--- 1.4/mysql-test/t/func_op.test	2003-12-10 18:30:33 +04:00
+++ 1.5/mysql-test/t/func_op.test	2005-11-06 12:35:46 +04:00
@@ -14,3 +14,15 @@
 select  0 | -1,  0 ^ -1,  0 & -1;
 select -1 >> 0, -1 << 0;
 select -1 >> 1, -1 << 1;
+
+#
+# Bug 13044: wrong bit_count() results
+#
+
+drop table if exists t1,t2;
+create table t1(a int);
+create table t2(a int, b int);
+insert into t1 values (1), (2), (3);
+insert into t2 values (1, 7), (3, 7);
+select t1.a, t2.a, t2.b, bit_count(t2.b) from t1 left join t2 on t1.a=t2.a;
+drop table t1, t2;
Thread
bk commit into 4.0 tree (ramil:1.2174) BUG#13044ramil6 Nov