| Bug #27694 | mysqlhotcopy & p5-DBD-mysql51-4.003 | ||
|---|---|---|---|
| Submitted: | 7 Apr 2007 10:53 | Modified: | 9 Oct 2007 2:33 |
| Reporter: | Oleg Alexeenkov | ||
| Status: | Closed | ||
| Category: | Client | Severity: | S2 (Serious) |
| Version: | 5.0.40-BK | OS: | Any |
| Assigned to: | Timothy Smith | Target Version: | |
| Tags: | Contribution, dbd, mysqlhotcopy | ||
[7 Apr 2007 12:04]
Valeriy Kravchuk
Thank you for a bug report and patch. Verified just as described with latest 5.0.40-BK on Linux.
[7 Apr 2007 13:55]
Oleg Alexeenkov
Ups.. Better patch:
# diff -p mysqlhotcopy.orig mysqlhotcopy
*** mysqlhotcopy.orig Sat Apr 7 12:33:41 2007
--- mysqlhotcopy Sat Apr 7 15:52:50 2007
*************** sub get_list_of_tables {
*** 838,843 ****
--- 838,844 ----
my $quote = $dbh->get_info(29); # SQL_IDENTIFIER_QUOTE_CHAR
if ($quote) {
foreach (@dbh_tables) {
+ s/$quote.*$quote\.//; #p5-DBD-mysql51-4.003 fix#
s/^$quote(.*)$quote$/$1/;
s/$quote$quote/$quote/g;
}
[14 Jul 2007 16:23]
Pavel Gubin
Similar patch [5.1.20 & p5-DBD-mysql51-4.005], but checks that 1st component is really this db -- maybe, unnecessary?
Attachment: mysqlhotcopy.diff (application/octet-stream, text), 443 bytes.
[15 Aug 2007 9:05]
Timothy Smith
It looks like this isn't due to DBD::mysql, but DBI itself. Current documentation for "tables" says "Returns a list of matching table names, possibly including a catalog/schema prefix". mysqlhotcopy should just use table_info() instead. DBI just calls the DBD's table_info() anyways, and we don't want the quoting, so table_info() is all around better.
[15 Aug 2007 9:35]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/32539 ChangeSet@1.2513, 2007-08-15 01:35:38-06:00, tsmith@ramayana.hindu.god +1 -0 Bug #27694: mysqlhotcopy & p5-DBD-mysql51-4.003 The symptom is that, when used with recent versions of DBD::mysql, mysqlhotcopy uses a double-qualified table name, for example: Invalid db.table name 'test.test`.`x' at /usr/bin/mysqlhotcopy line 855. This is caused by a change in DBD::mysql. See this diff: http://svn.perl.org/viewcvs/modules/DBD-mysql/trunk/lib/DBD/mysql.pm?r1=9183&r2=9188 Basically, older DBD::mysql implemented a limited ->table_info method; now the full method is implemented, and as a result DBI's ->tables() method has access to the schema value, so it uses it.
[15 Aug 2007 11:54]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/32548 ChangeSet@1.2513, 2007-08-15 03:54:39-06:00, tsmith@ramayana.hindu.god +1 -0 Bug #27694: mysqlhotcopy & p5-DBD-mysql51-4.003 Use "SHOW TABLES FROM `db`" instead of $dbh->tables() in the get_list_of_tables() routine. The symptom is that, when used with recent versions of DBD::mysql, mysqlhotcopy uses a double-qualified table name, for example: Invalid db.table name 'test.test`.`x' at /usr/bin/mysqlhotcopy line 855. This is caused by a change in DBD::mysql. See this diff: http://svn.perl.org/viewcvs/modules/DBD-mysql/trunk/lib/DBD/mysql.pm?r1=9183&r2=9188 Basically, older DBD::mysql implemented a limited ->table_info method; now the full method is implemented, and as a result DBI's ->tables() method has access to the schema value, so it uses it.
[20 Aug 2007 19:03]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/32765 ChangeSet@1.2513, 2007-08-20 11:00:51-06:00, tsmith@ramayana.hindu.god +1 -0 Bug #27694: mysqlhotcopy & p5-DBD-mysql51-4.003 Use "SHOW TABLES FROM `db`" instead of $dbh->tables() in the get_list_of_tables() routine. The symptom is that, when used with recent versions of DBD::mysql, mysqlhotcopy uses a double-qualified table name, for example: Invalid db.table name 'test.test`.`x' at /usr/bin/mysqlhotcopy line 855. This is caused by a change in DBD::mysql. See this diff: http://svn.perl.org/viewcvs/modules/DBD-mysql/trunk/lib/DBD/mysql.pm?r1=9183&r2=9188 Basically, older DBD::mysql implemented a limited ->table_info method; now the full method is implemented, and as a result DBI's ->tables() method has access to the schema value, so it uses it.
[28 Aug 2007 21:31]
Timothy Smith
Queued to 5.0- and 5.1-maint
[4 Sep 2007 19:11]
Bugs System
Pushed into 5.1.23-beta
[4 Sep 2007 19:13]
Bugs System
Pushed into 5.0.50
[9 Oct 2007 2:33]
Paul DuBois
Noted in 5.0.50, 5.1.23 changelogs. With recent versions of DBD::mysql, mysqlhotcopy generated table names that were doubly qualified with the database name.
[31 Jan 2008 22:57]
Sveta Smirnova
Bug #33640 was marked as duplicate of this one.
[12 Aug 7:06]
Sveta Smirnova
Bug #46653 and bug #27303 were marked as duplicate of this one.

Description: z# mysqlhotcopy a b Invalid db.table name 'a.a`.`c' at /usr/local/bin/mysqlhotcopy line 855. How to repeat: run mysqlhotcopy Suggested fix: z# diff -p mysqlhotcopy mysqlhotcopy.orig *** mysqlhotcopy Sat Apr 7 12:52:04 2007 --- mysqlhotcopy.orig Sat Apr 7 12:33:41 2007 *************** my $raid_dir_regex = '[A-Za-z0-9]{2}'; *** 268,274 **** foreach my $rdb ( @db_desc ) { my $db = $rdb->{src}; my @dbh_tables = get_list_of_tables( $db ); ! s/\w+\`\.\`// for @dbh_tables; #p5-DBD-mysql51-4.003 fix# ## generate regex for tables/files my $t_regex; my $negated; --- 268,274 ---- foreach my $rdb ( @db_desc ) { my $db = $rdb->{src}; my @dbh_tables = get_list_of_tables( $db ); ! ## generate regex for tables/files my $t_regex; my $negated;