Bug #11251 Incorrect syntax DEFAULT CHARSET=id in docs
Submitted: 10 Jun 2005 18:49 Modified: 14 Jun 2005 9:15
Reporter: Bill Karwin (Candidate Quality Contributor) (OCA) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:4.1 OS:Any (all)
Assigned to: Jon Stephens CPU Architecture:Any

[10 Jun 2005 18:49] Bill Karwin
Description:
There are a couple of minor doc mistakes confusing the word "character set" with "charset".  

In the following doc topics, an example of a CREATE TABLE statement contains incorrect syntax "DEFAULT CHARSET=latin1".  Using this syntax results in a syntax error in MySQL 4.0, 4.1, and 5.0.

Section 14.6.3. "How to use FEDERATED Tables"
Section 16.4.3. "Quick Test Setup of MySQL Cluster"

In the following doc topic a command-line option for mysqld, "--default-charset" is incorrectly referenced.

Section 10.3.1. "Server Character Set and Collation"

How to repeat:
Try to use syntax presented in examples in these doc topics, using the spelling "charset".  The syntax is not supported by MySQL.

Suggested fix:
The correct syntax according to the MySQL reference manual on the CREATE TABLE statement is "DEFAULT CHARACTER SET name".

The correct command-line option for mysqld is "--default-character-set=name"

The docs should use correct syntax.
[10 Jun 2005 23:45] Bill Karwin
Specifying version as 4.1 (though it's really a bug against the docs).
I acknowledge that the DEFAULT CHARACTER SET syntax was not supported in version 4.0 of MySQL.
[14 Jun 2005 9:15] Jon Stephens
I tested as shown; both versions of the syntax work correctly:

---------

mysql> SELECT VERSION(), @@version_compile_os;
+---------------------+----------------------+
| VERSION()           | @@version_compile_os |
+---------------------+----------------------+
| 5.0.3-beta-standard | pc-linux-gnu         |
+---------------------+----------------------+
1 row in set (0.00 sec)

mysql> SELECT VERSION(), @@version_compile_os;
+-----------------------+----------------------+
| VERSION()             | @@version_compile_os |
+-----------------------+----------------------+
| 5.0.6-beta-nt-max-log | Win32                |
+-----------------------+----------------------+
1 row in set (0.01 sec)

#  following executed on both MySQL installations shown above:

mysql> CREATE TABLE words1 (col VARCHAR(50)) DEFAULT CHARACTER SET=utf8;
Query OK, 0 rows affected (0.13 sec)

mysql> SHOW CREATE TABLE words1\G
*************************** 1. row ***************************
       Table: words1
Create Table: CREATE TABLE `words1` (
  `col` varchar(50) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

mysql> CREATE TABLE words2 (col VARCHAR(50)) DEFAULT CHARACTER SET=utf8;
Query OK, 0 rows affected (0.13 sec)

mysql> SHOW CREATE TABLE words2\G
*************************** 1. row ***************************
       Table: words2
Create Table: CREATE TABLE `words2` (
  `col` varchar(50) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

-------

Marked Closed/Not A Bug.
[14 Jun 2005 9:30] Jon Stephens
The second table in my example was in fact created using

CREATE TABLE words2 (col VARCHAR(50)) DEFAULT CHARSET=utf8;

The query shown in my previous comment was a copy/paste error and the DEFAULT CHARSET syntax *does* in fact work correctly and does *not* cause an error.