Bug #30194 Replication Failure on Slave when using stored procs with bit-type parameters.
Submitted: 2 Aug 2007 4:54 Modified: 2 Aug 2007 7:33
Reporter: Brad Peterson Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Replication Severity:S2 (Serious)
Version:5.0.37 OS:Any
Assigned to: CPU Architecture:Any
Tags: bit parameter, replication, slave

[2 Aug 2007 4:54] Brad Peterson
Description:
If a stored procure accepts a bit value as one of it's parameters, it can function correctly on the master, but it will break replication on the slave.

It appears this bug was reported before, but it was assumed that at after 5.0.27, the problem was fixed.  I am still seeing the issue on 5.0.37, and can duplicate it.  The steps to repeat are given.  I cannot find any clean workaround so that I can pass in a bit value as an argument into a procedure.

How to repeat:
On the master, run these from the command prompt:

CREATE DATABASE test;
USE test;
CREATE TABLE t (b BIT(1));
DELIMITER $$
CREATE PROCEDURE testbug(bitvalue BIT)
BEGIN
  INSERT INTO t SET b = bitvalue;
END $$
DELIMITER ; 
CALL testbug(1);
SELECT * FROM t;

The master stored the value.  It will display:
+------+
| b    |
+------+
|     |
+------+
1 row in set (0.00 sec)

Further, if you run SELECT * FROM t; from the Query Browser actually shows the value as b'1'

But on the slave, the replication is broken.  If you do a doing a SHOW SLAVE STATUS\G, you'll see that it reports:
Last_Errno: 1064
Last_Error: Error 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1' on query. Default database: 'test'. Query: 'INSERT INTO t SET b =  NAME_CONST('bitvalue',)'
[2 Aug 2007 4:56] Brad Peterson
I forgot to add..the bug was initially reported here. 

http://bugs.mysql.com/bug.php?id=26199

Again, it was wrongly assumed that the bug had already been fixed.
[2 Aug 2007 7:33] Sveta Smirnova
Thank you for the report.

As this is same as bug #26199 I marked this report as duplicate of bug #26199. Please subscribe to bug #26199 and add comments to that one,