Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 5.3.12, 5.5.39, 10.0.14
-
Fix Version/s: 10.1.4
-
Component/s: Character Sets
-
Labels:None
Description
I create a database with some question marks in the name:
DROP DATABASE IF EXISTS `test????`; CREATE DATABASE `test????`;
Now I run a "USE" query with a bad byte sequence:
SET NAMES utf8;
USE `test๐`;
SELECT DATABASE(), HEX(DATABASE());
(notice. '๐' is a four-byte UTF-8 character, which is considered as a wrong
byte sequence by MariaDB's 3-byte "utf8").
It erroneously connects to the database 'test????':
ariaDB [(none)]> SET NAMES utf8; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> USE `test๐`; Database changed MariaDB [test๐]> SELECT DATABASE(), HEX(DATABASE()); +------------+------------------+ | DATABASE() | HEX(DATABASE()) | +------------+------------------+ | test???? | 746573743F3F3F3F | +------------+------------------+ 1 row in set (0.00 sec)
The correct behaviour would be report either "unknown database",
or "bad database name" or "Invalid utf8 character string: 'test\xF0\x9F\x98\x81'".
The latter would be consistent with what's reported on attempt to
create a database with such a broken name:
MariaDB [test]> CREATE DATABASE `test๐`; ERROR 1300 (HY000): Invalid utf8 character string: 'test\xF0\x9F\x98\x81'
A similar problem also happens with table names.
I create a table with question marks in its name:
SET NAMES utf8; DROP TABLE IF EXISTS `test????`; CREATE TABLE `test????` (a INT); INSERT INTO `test????` values (10);
Now I change the connection character set to utf8mb4 and run a SELECT query:
SET NAMES utf8mb4; SELECT * FROM `test๐๐๐๐`;
It returns rows from the table `test????`:
+------+ | a | +------+ | 10 | +------+ 1 row in set (0.01 sec)
The expected behaviour would be to return some error.
Gliffy Diagrams
Attachments
Issue Links
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions