Bug #22005 column_info does not accept dashes in table names
Submitted: 4 Sep 2006 23:58 Modified: 28 Dec 2006 21:51
Reporter: James Dennis Email Updates:
Status: Closed Impact on me:
None 
Category:Connectors: DBD::mysql ( Perl ) Severity:S3 (Non-critical)
Version:3.0006 OS:Linux (Linux)
Assigned to: Jim Winstead CPU Architecture:Any
Tags: column_info, wildcards

[4 Sep 2006 23:58] James Dennis
Description:
The column_info subroutine rejects table names with dashes in them with "column_info doesn't support table wildcard". Table names with dashes are legal in MySQL.

How to repeat:
$sth = $self->{dbh}->column_info(undef, undef, 'test-table', '%' );

Suggested fix:
--- mysql.pm.old        2006-08-29 11:46:27.000000000 -0400
+++ mysql.pm    2006-08-29 11:47:34.000000000 -0400
@@ -297,7 +297,7 @@
sub column_info {
     my ($dbh, $catalog, $schema, $table, $column) = @_;
     return $dbh->set_err(1, "column_info doesn't support table wildcard")
-       if $table !~ /^\w+$/;
+       if $table !~ /^[-\w]+$/;
     return $dbh->set_err(1, "column_info doesn't support column selection")
        if $column ne "%";
[2 Oct 2006 13:57] Valeriy Kravchuk
Thank you for a bug report (and patch). Verified just as described.
[30 Oct 2006 15:21] James Dennis
Is there an ETA on the inclusion of this patch?
[4 Nov 2006 16:17] Philip Stoev
I bumped into the same issue today because I was passing a table name ending in "\0". However, to the best of my understanding, the regular expression is still very restrictive, since:

http://dev.mysql.com/doc/refman/5.0/en/legal-names.html

says that basically all characters are allowed except slashes and dots.
[28 Dec 2006 21:51] Jim Winstead
I've simply removed this test. Once Bug #23974 is fixed, using wildcards will just result in a table not found error. Thanks for the report.