Bug #6552 CHAR column w/o length is legal, BINARY w/o length is not
Submitted: 10 Nov 2004 16:41 Modified: 16 Nov 2004 8:14
Reporter: Paul DuBois Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.x OS:
Assigned to: Alexander Barkov CPU Architecture:Any

[10 Nov 2004 16:41] Paul DuBois
Description:
CHAR holds non-binary strings and BINARY holds binary
strings, but other than that, the two column types are
similar in most ways.

However, there is one inconsistency in how columns of
the two types can be declared.  CHAR can be declared
without a length, and becomes CHAR(1).  BINARY cannot
be declared without a length. An error occurs if you try
it.

How to repeat:
mysql> CREATE TABLE t1 (c CHAR);
Query OK, 0 rows affected (0.01 sec)

mysql> SHOW CREATE TABLE t1\G
*************************** 1. row ***************************
       Table: t1
Create Table: CREATE TABLE `t1` (
  `c` char(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

mysql> CREATE TABLE t2 (b BINARY);
ERROR 1064 (42000): 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

Suggested fix:
Allow BINARY without a length to be used as a
synonym for BINARY(1).