Bug #65914 | DB names with special characters like '.' and '-' do not get quoted in binlog | ||
---|---|---|---|
Submitted: | 16 Jul 2012 19:35 | Modified: | 14 Feb 2013 11:47 |
Reporter: | Grant McAlister | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Replication | Severity: | S2 (Serious) |
Version: | 5.5.25a | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | binlog, Database name, special character, Use |
[16 Jul 2012 19:35]
Grant McAlister
[17 Jul 2012 4:27]
Valeriy Kravchuk
I can confirm that database names in USE statements are not quoted. But I do not see any problems as a result: macbook-pro:5.5 openxs$ bin/mysql -uroot testReading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 Server version: 5.5.26-debug-log Source distribution Copyright (c) 2000, 2011, 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 test.1-2; 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 '.1-2' at line 1 mysql> create database `test.1-2`; Query OK, 1 row affected (0.01 sec) mysql> use test.1-2; Database changed
[17 Jul 2012 9:20]
Peter Laursen
Now .. what about database names with a SPACE-character in them? Are such also not quoted in binlog? The full unicoce range (except for NULL) is valid in identifiers and not quoting is gambling IMO! CREATE DATABASE `my database`; USE my database; -- 1064 error
[17 Jul 2012 10:34]
Valeriy Kravchuk
Peter, Yes, your case with space in the database name shows that we do have a real bug in mysqlbinlog: ... # at 3168 #120717 13:29:34 server id 1 end_log_pos 3255 Query thread_id=7 exec_time=0 error_code=0 SET TIMESTAMP=1342520974/*!*/; create database `my db` /*!*/; # at 3255 #120717 13:30:43 server id 1 end_log_pos 3342 Query thread_id=8 exec_time=0 error_code=0 use my db/*!*/; SET TIMESTAMP=1342521043/*!*/; create table t1(c1 int) /*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; This USE will not work properly. mysqlbinlog should quote database names in USE statements generated. Like SHOW BINLOG EVENTS does: ... | macbook-pro-bin.000001 | 3075 | Query | 1 | 3168 | create database `test.1-2` | | macbook-pro-bin.000001 | 3168 | Query | 1 | 3255 | create database `my db` | | macbook-pro-bin.000001 | 3255 | Query | 1 | 3342 | use `my db`; create table t1(c1 int) | ...
[14 Feb 2013 11:47]
Erlend Dahl
This was fixed along with the fix for bug#66550 in 5.1.67, 5.5.29, and 5.6.8.