Bug #1972 BIT_AND() and BIT_OR() still return a *signed* 64bit value
Submitted: 27 Nov 2003 9:01 Modified: 10 Dec 2003 4:45
Reporter: Masaki Fujimoto Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:4.0.16 OS:Any (Any)
Assigned to: Konstantin Osipov CPU Architecture:Any

[27 Nov 2003 9:01] Masaki Fujimoto
Description:
We can find the ChangeLog entry that claims as follows, in the chapter "D.3.5 Changes in release 4.0.13 (16 May 2003)":

* BIT_AND() and BIT_OR() now return an unsigned 64 bit value. 

but it seems that BIT_AND() and BIT_OR() still return a *signed* 64 bit value (please see also simple sqls at "How to repeat"). 

Besides, the manual just says that "The calculation is performed with 64-bit (BIGINT) precision" and no description about return value, so actually I cannot figure out what is the correct behavior and what the ChangeLog entry (quoted above) really means.

How to repeat:
CREATE TABLE t1 (col int);
INSERT INTO t1 VALUES (-1);
SELECT BIT_AND(col) FROM t1;

these result in as follows:
+--------------+
| BIT_AND(col) |
+--------------+
|           -1 |
+--------------+
[9 Dec 2003 15:29] Konstantin Osipov
Should be fixed with fix for bug #1790
[10 Dec 2003 4:45] Konstantin Osipov
Fixed in 4.0.17: bk commit - 4.0 tree (konstantin:1.1642)