Overhaul of test warning handling - mask off as little as possible
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / backcompat / 0.04006 / lib / dbixcsl_common_tests.pm
index 6edbe61..9e2b967 100644 (file)
@@ -542,12 +542,6 @@ sub run_tests {
         );
 
         {
-            # Silence annoying but harmless postgres "NOTICE:  CREATE TABLE..."
-            local $SIG{__WARN__} = sub {
-                my $msg = shift;
-                warn $msg unless $msg =~ m{^NOTICE:\s+CREATE TABLE};
-            };
-
             my $dbh = $self->dbconnect(1);
             $dbh->do($_) for @statements_rescan;
             $dbh->disconnect;
@@ -582,6 +576,9 @@ sub dbconnect {
     if ($self->{dsn} =~ /^[^:]+:SQLite:/) {
       $dbh->do ('PRAGMA synchronous = OFF');
     }
+    elsif ($self->{dsn} =~ /^[^:]+:Pg:/) {
+      $dbh->do ('SET client_min_messages=WARNING');
+    }
 
     die "Failed to connect to database: $DBI::errstr" if !$dbh;
 
@@ -908,12 +905,6 @@ sub create {
 
     my $dbh = $self->dbconnect(1);
 
-    # Silence annoying but harmless postgres "NOTICE:  CREATE TABLE..."
-    local $SIG{__WARN__} = sub {
-        my $msg = shift;
-        warn $msg unless $msg =~ m{^NOTICE:\s+CREATE TABLE};
-    };
-
     $dbh->do($_) for (@statements);
     unless($self->{skip_rels}) {
         # hack for now, since DB2 doesn't like inline comments, and we need