Bug #16637 Error "Data too long for column" occures when inserting BIT value into a table
Submitted: 19 Jan 2006 15:39 Modified: 19 Jan 2006 15:56
Reporter: Andrey Kazachkov Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.17-nt OS:Windows (Windows)
Assigned to: CPU Architecture:Any

[19 Jan 2006 15:39] Andrey Kazachkov
Description:
Error "Data too long for column" occures when inserting BIT value into a column which of BIT type. 

How to repeat:
Such script generates error "Data too long for column 'bData' at row 1". 
 
delimiter GO

DROP TABLE IF EXISTS ak_test_t_3
GO

CREATE TABLE ak_test_t_3(
	nId int AUTO_INCREMENT PRIMARY KEY,
	bData bit,
	strData varchar(32)
)ENGINE=InnoDB DEFAULT CHARSET=utf8
GO

DROP PROCEDURE IF EXISTS ak_p_test_3
GO

CREATE PROCEDURE ak_p_test_3()
BEGIN
	DECLARE tmp_bData bit;
	SET tmp_bData = 1;
	INSERT INTO ak_test_t_3(bData, strData) VALUES(tmp_bData, 'xxx');	
END
GO

CALL ak_p_test_3()
GO

delimiter ;
[19 Jan 2006 15:56] MySQL Verification Team
Thank you for taking the time to report a problem.  Unfortunately
you are not using a current version of the product your reported a
problem with -- the problem might already be fixed. Please download
a new version from http://www.mysql.com/downloads/

If you are able to reproduce the bug with one of the latest versions,
please change the version on this bug report to the version you
tested and change the status back to "Open".  Again, thank you for
your continued support of MySQL.

Additional info:

c:\mysql\bin>mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 5.0.18-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> delimiter GO
mysql>
mysql> DROP TABLE IF EXISTS ak_test_t_3
    -> GO
Query OK, 0 rows affected, 1 warning (0.16 sec)

mysql>
mysql> CREATE TABLE ak_test_t_3(
    ->  nId int AUTO_INCREMENT PRIMARY KEY,
    ->  bData bit,
    ->  strData varchar(32)
    -> )ENGINE=InnoDB DEFAULT CHARSET=utf8
    -> GO
Query OK, 0 rows affected (0.42 sec)

mysql>
mysql> DROP PROCEDURE IF EXISTS ak_p_test_3
    -> GO
Query OK, 0 rows affected, 1 warning (0.17 sec)

mysql>
mysql> CREATE PROCEDURE ak_p_test_3()
    -> BEGIN
    ->  DECLARE tmp_bData bit;
    ->  SET tmp_bData = 1;
    ->  INSERT INTO ak_test_t_3(bData, strData) VALUES(tmp_bData, 'xxx

    -> END
    -> GO
Query OK, 0 rows affected (0.17 sec)

mysql>
mysql> CALL ak_p_test_3()
    -> GO
Query OK, 1 row affected (0.22 sec)
[8 Apr 2016 3:27] Vince Eagen
see 79604 for a more recent version of this bug
https://bugs.mysql.com/bug.php?id=79604