Bug #72552 Can't create databse with "\" as last character in the identifier.
Submitted: 6 May 2014 14:29 Modified: 7 May 2014 11:14
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.6.17 OS:Any
Assigned to: CPU Architecture:Any

[6 May 2014 14:29] Peter Laursen
Description:
For some reason the `backtick` character cannot be specified as the last character of a database name using Windows CLI (at least).

How to repeat:
CLI on Windows: 

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.6.17-log MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE DATABASE `testme`;
Query OK, 1 row affected (0.00 sec)

mysql> CREATE DATABASE `testme\testme`;
Query OK, 1 row affected (0.00 sec)

mysql> CREATE DATABASE `testme\testme\`;
    `>

The client does not read the ";" terminator/delimiter after the 3rd CREATE DATABASE statement. It waits forever for the delimiter to be inputted by user. Typing ";" again does nothing. The same prompt appears. 

I have not checked but I guess it is possible to trigger similar issues with other types of statements. It looks like a simple line-parser issue (and not SQL related at all as the client is 'SQL-agnostic')

Also note the backtick appearing on the command prompt on the new line in teh prompt returned. This looks weird.

Suggested fix:
Not sure if this is specific for CLI on Windows.  The statement "CREATE DATABASE `test\test\`;" works as expected in SQLyog and it also should work as long as the identifier is `backquoted`.
[6 May 2014 16:23] MySQL Verification Team
Hm, it does work, but the client doesn't seem to be very happy about it:

mysql> create database `testme\testme\` ;
    `> `
    -> ;
Query OK, 1 row affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax;
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
| testme\testme\     |
+--------------------+
5 rows in set (0.00 sec)
[6 May 2014 16:26] MySQL Verification Team
using  --binary-mode --named-commands=0 had no impact.
[6 May 2014 18:55] Peter Laursen
Please compare the command line output on Shane's environment and mine .. It is *NOT* the same. And I simply copy/pasted from cmd.exe.

Differences: 

1) For me the command prompt includes a backtick after the failed statement
2) I cannot 'release the client' by typng the ";" delimiter on a new line. It helps nothing on my environment.  The same garbage command prompt appears after that.

My environment is Win7/64bit.
[7 May 2014 11:14] Peter Laursen
I meant (of course):

For some reason the *backslash* character cannot ..