Bug #10617 Insert from same table to same table give incorrect result for bit(4) column.
Submitted: 13 May 2005 10:44 Modified: 7 Jul 2005 16:39
Reporter: Disha Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.5 Beta OS:Microsoft Windows (Windows 2000 Server)
Assigned to: Ramil Kalimullin CPU Architecture:Any

[13 May 2005 10:44] Disha
Description:
If we insert from same table to same table having a bit column with length 4 then incorrect result is observed fro bit column.

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 an integer and a bit column having length 4 and insert values in it as follows:
   create table t1(f1 int, f2 bit(4))//
   insert into t1 values(1,1),(2,2),(3,3),(4,4),(5,5)//

4. Now insert values from the same table to the same table as follows:
   insert into t1 select * from t1//

Expected Results: 
1. The insert should succeed by inserting all the values again to the same table.

Actual Results: 
1. For the bit column the last value is repeated for all new rows inserted. The resultant table contents are as follows:

   mysql> select f1,Bin(f2+0) from t1//
   +------+-----------+
   | f1   | Bin(f2+0) |
   +------+-----------+
   |    1 | 1         |
   |    2 | 10        |
   |    3 | 11        |
   |    4 | 100       |
   |    5 | 101       |
   |    1 | 101       |
   |    2 | 101       |
   |    3 | 101       |
   |    4 | 101       |
   |    5 | 101       |
   +------+-----------+
   10 rows in set (0.00 sec)
   
   mysql>
   
2. Please note the correct values for the integer field f1.
[13 May 2005 11:32] Hartmut Holzgraefe
Verified on linux with latest 5.0bk, 4.1.11 works as expected
[30 Jun 2005 9:34] Ramil Kalimullin
fixed in 5.0.9
[7 Jul 2005 16:39] Jon Stephens
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Documented fix in 5.0.9 change history; closed.