Bug #10553 The output of BIN function cannot be inserted in a BIT field.
Submitted: 11 May 2005 12:58 Modified: 12 May 2005 20:47
Reporter: Disha Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.5 Beta OS:Windows (Windows 2003)
Assigned to: CPU Architecture:Any

[11 May 2005 12:58] Disha
Description:
The output of a bin function cannot be inserted in a bit field.

How to repeat:
1. Start the MySQL client and connect to the database with valid user and password.
2. Set the delimiter to //
3. Create a table with bit field.
   create table t1(f1 bit(8))//
   
4. Try to run the following query to insert the output if BIN function in the table.
   insert into t1 select bin(10)//
   Insert into t1 values(bin(10))//
   
Expected Results: 
1. Both insert statements should insert a value 1010 in the table.

Actual Results: 
1. Warning is displayed though the value is not out if range.
Warning | 1264 | Out of range value adjusted for column 'f1' at row 1   
2. The contents of the table after the errors is as follows:

   mysql> select bin(f1+0) from t1//
   +-----------+
   | bin(f1+0) |
   +-----------+
   | 11111111  |
   | 11111111  |
   +-----------+
   2 rows in set (0.00 sec)
   mysql>
[11 May 2005 13:47] MySQL Verification Team
Verified on Linux.
[12 May 2005 20:47] Sergei Golubchik
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

See http://dev.mysql.com/doc/mysql/en/string-functions.html
BIN is not supposed to return a bitfield