Bug #33221 SET {NAMES,CHARACTER SET} does not reject ucs2
Submitted: 13 Dec 2007 16:44 Modified: 25 May 2010 16:20
Reporter: Paul DuBois Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Charsets Severity:S4 (Feature request)
Version:all OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[13 Dec 2007 16:44] Paul DuBois
Description:
In the manual, we say that ucs2 does not work as a client character set:

"ucs2 cannot be used as a client character set, which means that it does not work for SET NAMES or SET CHARACTER SET."

http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html

And indeed, if you try it, things quickly go bad:

mysql> SET NAMES ucs2;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW DATABASES;
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 'SHOW DATABASES' at line 1
mysql> SELECT VERSION();
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 'SELECT VERSION()' at line 1

That can be very confusing for the user, because the error provides no clue what the problem really is.

Given that ucs2 has no possibility of working in this context, why do SET NAMES and SET CHARACTER SET not reject any attempt to use ucs2?

(In 6.0 and up, this should include utf16 and utf32, which also cannot be used as a client character set.)

How to repeat:
See above.

Suggested fix:
Reject attempts to use character sets that cannot work as client character sets.
[14 Dec 2007 17:51] Susanne Ebrecht
Verified as described.
[18 Dec 2007 21:52] Paul DuBois
In MySQL 6.0, this should also apply to utf16 and utf32, which also cannot be used as client character sets.
[25 May 2010 16:20] Paul DuBois
Duplicate of Bug#31615.