release 0.07017
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / DBI.pm
index 17451a0..1e3f423 100644 (file)
@@ -9,7 +9,7 @@ use List::MoreUtils 'any';
 use namespace::clean;
 use DBIx::Class::Schema::Loader::Table ();
 
-our $VERSION = '0.07015';
+our $VERSION = '0.07017';
 
 __PACKAGE__->mk_group_accessors('simple', qw/
     _disable_pk_detection
@@ -328,7 +328,9 @@ sub _table_comment {
     my $comments_table = $table->clone;
     $comments_table->name($self->table_comments_table);
 
-    my ($comment) = try { $dbh->selectrow_array(<<"EOF") };
+    my ($comment) =
+        (exists $self->_tables->{$comments_table->sql_name} || undef)
+        && try { $dbh->selectrow_array(<<"EOF") };
 SELECT comment_text
 FROM @{[ $comments_table->sql_name ]}
 WHERE table_name = @{[ $dbh->quote($table->name) ]}
@@ -351,7 +353,9 @@ sub _column_comment {
     my $comments_table = $table->clone;
     $comments_table->name($self->column_comments_table);
 
-    my ($comment) = try { $dbh->selectrow_array(<<"EOF") };
+    my ($comment) =
+        (exists $self->_tables->{$comments_table->sql_name} || undef)
+        && try { $dbh->selectrow_array(<<"EOF") };
 SELECT comment_text
 FROM @{[ $comments_table->sql_name ]}
 WHERE table_name = @{[ $dbh->quote($table->name) ]}