Description:
You can create a table name with a backtick
in it like this:
mysql> create table ```a` (i int);
Query OK, 0 rows affected (0.37 sec)
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| `a |
+----------------+
1 row in set (0.00 sec)
But mysqldump won't dump it properly:
% mysqldump --no-data test
-- MySQL dump 10.5
--
-- Host: localhost Database: test
-- ------------------------------------------------------
-- Server version 4.1.2-alpha-debug-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT,
CHARACTER_SET_CLIENT=utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0
*/;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
mysqldump: Got error: 1064: 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
' READ /
*!32311 LOCAL */' at line 1 when using LOCK TABLES
The query that was sent to the server by mysqldump is:
LOCK TABLES ``a` READ /*!32311 LOCAL */
How to repeat:
See above.
Suggested fix:
Not sure. I thought it might be:
--- mysqldump.c.orig Tue Jan 20 10:51:35 2004
+++ mysqldump.c Fri Jan 30 20:27:46 2004
@@ -649,7 +649,7 @@
while (*name)
{
if (*name == QUOTE_CHAR)
- *to= QUOTE_CHAR;
+ *to++= QUOTE_CHAR;
*to++= *name++;
}
to[0]=QUOTE_CHAR;
However, although that seems to cause the
generated statement to be correct:
LOCK TABLES ```a` READ /*!32311 LOCAL */
It still results in a syntax error when mysqldump
sends it to the server:
% mysqldump --no-data test
-- MySQL dump 10.5
--
-- Host: localhost Database: test
-- ------------------------------------------------------
-- Server version 4.1.2-alpha-debug-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT,
CHARACTER_SET_CLIENT=utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0
*/;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
mysqldump: Got error: 1103: Incorrect table name '' when using LOCK TABLES
I don't understand that, because if I copy and paste the query
from the log into the mysql client, the statement *works*.
???
Description: You can create a table name with a backtick in it like this: mysql> create table ```a` (i int); Query OK, 0 rows affected (0.37 sec) mysql> show tables; +----------------+ | Tables_in_test | +----------------+ | `a | +----------------+ 1 row in set (0.00 sec) But mysqldump won't dump it properly: % mysqldump --no-data test -- MySQL dump 10.5 -- -- Host: localhost Database: test -- ------------------------------------------------------ -- Server version 4.1.2-alpha-debug-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */; mysqldump: Got error: 1064: 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 ' READ / *!32311 LOCAL */' at line 1 when using LOCK TABLES The query that was sent to the server by mysqldump is: LOCK TABLES ``a` READ /*!32311 LOCAL */ How to repeat: See above. Suggested fix: Not sure. I thought it might be: --- mysqldump.c.orig Tue Jan 20 10:51:35 2004 +++ mysqldump.c Fri Jan 30 20:27:46 2004 @@ -649,7 +649,7 @@ while (*name) { if (*name == QUOTE_CHAR) - *to= QUOTE_CHAR; + *to++= QUOTE_CHAR; *to++= *name++; } to[0]=QUOTE_CHAR; However, although that seems to cause the generated statement to be correct: LOCK TABLES ```a` READ /*!32311 LOCAL */ It still results in a syntax error when mysqldump sends it to the server: % mysqldump --no-data test -- MySQL dump 10.5 -- -- Host: localhost Database: test -- ------------------------------------------------------ -- Server version 4.1.2-alpha-debug-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */; mysqldump: Got error: 1103: Incorrect table name '' when using LOCK TABLES I don't understand that, because if I copy and paste the query from the log into the mysql client, the statement *works*. ???