Bug #2601 USE `abc de` does not work in mysql client
Submitted: 1 Feb 2004 12:06 Modified: 2 Feb 2004 4:48
Reporter: Heikki Tuuri Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:4.0.17 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[1 Feb 2004 12:06] Heikki Tuuri
Description:
Hi!

Tested with the latest 4.0 tree. I can create a database with a space in its name, but USE ... does not work in the mysql client. On the other hand, giving the database name as a command parameter to mysql works.

Regards,

Heikki

heikki@hundin:~/mysql-4.0/client> ./mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.18-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database `abc de`;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+----------+
| Database |
+----------+
| abc de   |
| mysql    |
| test     |
| test2    |
+----------+
4 rows in set (0.00 sec)

mysql> create table `abc de`.`kuk kuu`(a int) type = innodb;
Query OK, 0 rows affected (0.03 sec)

mysql> use `abc de`;
ERROR 1049: Unknown database '`abc'
mysql> exit
Bye
heikki@hundin:~/mysql-4.0/client> ./mysql "abc de"
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.0.18-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show tables;
+------------------+
| Tables_in_abc de |
+------------------+
| kuk kuu          |
+------------------+
1 row in set (0.00 sec)

How to repeat:
heikki@hundin:~/mysql-4.0/client> ./mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.18-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database `abc de`;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+----------+
| Database |
+----------+
| abc de   |
| mysql    |
| test     |
| test2    |
+----------+
4 rows in set (0.00 sec)

mysql> create table `abc de`.`kuk kuu`(a int) type = innodb;
Query OK, 0 rows affected (0.03 sec)

mysql> use `abc de`;
ERROR 1049: Unknown database '`abc'
mysql> exit
Bye
heikki@hundin:~/mysql-4.0/client> ./mysql "abc de"
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.0.18-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show tables;
+------------------+
| Tables_in_abc de |
+------------------+
| kuk kuu          |
+------------------+
1 row in set (0.00 sec)

Suggested fix:
Fix the USE syntax parser in the client or the server.
[2 Feb 2004 4:48] Sergei Golubchik
Thank you for your bug report. This issue has already been fixed
in the latest released version of that product, which you can download at 
http://www.mysql.com/downloads/

Additional info:

It is fixed in 4.1.1

As the problem is very minor (and a trivial workaroud is to use the client from 4.1.1, one doesn't need to upgrade the server) the patch will not be backported to 4.0