From: Rafael Kitover Date: Fri, 5 Feb 2010 12:18:05 +0000 (-0500) Subject: more robust $dbh->tables parsing for sometimes-quoted Pg tables X-Git-Tag: 0.05001~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c5ff1f26b1537e8184313cb6d05f86c4a31fd3b8;p=dbsrgits%2FDBIx-Class-Schema-Loader.git more robust $dbh->tables parsing for sometimes-quoted Pg tables --- diff --git a/lib/DBIx/Class/Schema/Loader/DBI.pm b/lib/DBIx/Class/Schema/Loader/DBI.pm index ba314ee..d87d509 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI.pm @@ -90,9 +90,11 @@ sub _tables_list { my $dbh = $self->schema->storage->dbh; my @tables = $dbh->tables(undef, $self->db_schema, $table, $type); - my $qt = qr/\Q$self->{_quoter}\E/; + my $qt = qr/[\Q$self->{_quoter}\E"'`\[\]]/; - if ($self->{_quoter} && $tables[0] =~ /$qt/) { + my $all_tables_quoted = (grep /$qt/, @tables) == @tables; + + if ($self->{_quoter} && $all_tables_quoted) { s/.* $qt (?= .* $qt)//xg for @tables; } else { s/^.*\Q$self->{_namesep}\E// for @tables;