Bug #82419 Supplementary unicode characters accepted for schema object names
Submitted: 3 Aug 2016 9:21 Modified: 3 Aug 2016 9:53
Reporter: Sergei Glushchenko Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:5.6, 5.7, 5.7.14 OS:Any
Assigned to: CPU Architecture:Any

[3 Aug 2016 9:21] Sergei Glushchenko
Description:
According to the page http://dev.mysql.com/doc/refman/5.7/en/identifiers.html

ASCII NUL (U+0000) and supplementary characters (U+10000 and higher) are not permitted in quoted or unquoted identifiers.

Moreover MySQL is using 3-byte subset of UTF-8 internally, which cannot represent such characters at all.

However the server doesn't reject such characters when I type them in as schema object names.

How to repeat:
mysql> set names utf8mb4;
Query OK, 0 rows affected (0.00 sec)

mysql> create database 𦉘𦟌𦧲;
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> use 𦉘𦟌𦧲;
Database changed
mysql> create table 𦉘𦟌𦧲 (𦉘𦟌𦧲 INT);
Query OK, 0 rows affected, 2 warnings (0.01 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| ???                |
| mtr                |
| mysql              |
| performance_schema |
| sys                |
| test               |
+--------------------+
7 rows in set (0.00 sec)

mysql> show tables;
+---------------+
| Tables_in_??? |
+---------------+
| ???           |
+---------------+
1 row in set (0.00 sec)

mysql> show create table 𦉘𦟌𦧲\G
*************************** 1. row ***************************
       Table: ???
Create Table: CREATE TABLE `???` (
  `???` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set, 1 warning (0.00 sec)

Suggested fix:
Reject incorrect characters in the schema object names.
[3 Aug 2016 9:53] MySQL Verification Team
Hello Sergei,

Thank you for the report and test case.
Verified as described with 5.7.14 build.

Thanks,
Umesh