Bug #773 mysqlhotcopy fails with "error in your SQL syntax."
Submitted: 1 Jul 2003 7:28 Modified: 4 Jul 2003 8:19
Reporter: Alex Syrov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0 and 4.1 OS:Linux (Linux - RedHat9)
Assigned to: Jani Tolonen CPU Architecture:Any

[1 Jul 2003 7:28] Alex Syrov
Description:
Linux: RedHat9; mysql 4.0; mysqlhotcopy 1.18; latest DBI and DBD; mysql installed from binaries (not RPM); PERL,DBI and DBD compiled from cpan.

get_list_of_tables is returning quoted table names and looks like it is right according to CPAN

>If $dbh->get_info(29) returns true (29 is >SQL_IDENTIFIER_QUOTE_CHAR) then the table names are >constructed and quoted by /quote_identifier to ensure they >are usable even if they contain whitespace or reserved >words etc. 

after call to quote_names, table name looks like "`dbname`.``tblname``" and mysqlhotcopy terminates with
DBD::mysql::db do failed: You have an error in your SQL syntax.

I had to change last line in quote_names from

return "`$db`.'$table'"; 
#to
return "`$db`.$table";

after this mysqlhotcopy was able to run

How to repeat:
Dual P3 933; RedHat 9 with minimal config; MYSQL 4.0 from mysql.com (binary install) [mysqlhotcopy 1.18]

Compiled PERL from CPAN (LANG=C [not UTF])
Compiled DBI and DBD from CPAN

Suggested fix:
The described fix is good for my particular case, however on Solaris, you will need to have 
return "`$db`.'$table'";
for proper tablename quotation, I guess I will leave fix up to you.
[4 Jul 2003 8:19] Jani Tolonen
Fixed in version 1.19.

The problem is that earlier versions of DBD return table name non-quoted,
such as DBD-2.1012 and the newer ones, such as DBD-2.9002 returns it quoted.
There is a support built into mysqlhotcopy for both versions now.
Regards,
Jani