Bug #9964 Setting a default for BIT columns kills connection.
Submitted: 18 Apr 2005 2:44 Modified: 18 Apr 2005 3:39
Reporter: D Kline Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S3 (Non-critical)
Version:5.0.3-beta OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[18 Apr 2005 2:44] D Kline
Description:
CREATE TABLE or ALTER TABLE statements that set default  columns of type BIT result in "ERROR 2013 (HY000): Lost connection to MySQL server during query."

How to repeat:
Create a table with a bit column:

CREATE TABLE bug_test (
  test_id int(10) unsigned NOT NULL,
  descrip varchar(255) NOT NULL,
  is_broken bit(1) NOT NULL,
  PRIMARY KEY  (test_id)
) ENGINE=MyISAM;

then execute an ALTER TABLE / MODIFY COLUMN statement against that column to create a default:

ALTER TABLE bug_test MODIFY COLUMN is_broken bit(1) NOT NULL DEFAULT b'0';

Although b'0' would seem to be the appropriate syntax, this error can also be replicated using "DEFAULT 0."
[18 Apr 2005 2:46] D Kline
corrected description:

CREATE TABLE or ALTER TABLE statements that set default values for columns of type BIT result in "ERROR 2013 (HY000): Lost connection to MySQL server during query."
[18 Apr 2005 3:39] MySQL Verification Team
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:

iguel@light:~$ dbs/5.0/bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.5-beta-debug

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

mysql> use test;
Database changed
mysql> CREATE TABLE bug_test (
    ->   test_id int(10) unsigned NOT NULL,
    ->   descrip varchar(255) NOT NULL,
    ->   is_broken bit(1) NOT NULL,
    ->   PRIMARY KEY  (test_id)
    -> ) ENGINE=MyISAM;
Query OK, 0 rows affected (0.05 sec)

mysql>
mysql> ALTER TABLE bug_test MODIFY COLUMN is_broken bit(1) NOT NULL DEFAULT b'0';
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0