Author: turnstep
Date: Sat Jan 19 05:42:06 2008
New Revision: 10613

Modified:
   DBD-Pg/trunk/t/dbdpg_test_setup.pl

Log:
Account for bsd default postgres user.


Modified: DBD-Pg/trunk/t/dbdpg_test_setup.pl
==============================================================================
--- DBD-Pg/trunk/t/dbdpg_test_setup.pl  (original)
+++ DBD-Pg/trunk/t/dbdpg_test_setup.pl  Sat Jan 19 05:42:06 2008
@@ -68,12 +68,23 @@
                                $helpconnect += 2;
                        }
                        $helpconnect += 4;
-                       $ENV{DBI_USER} = 'postgres';
+                       $ENV{DBI_USER} = $^O =~ /bsd/ ? '_postgresql' : 
'postgres';
                        eval {
                                $dbh = DBI->connect($ENV{DBI_DSN}, 
$ENV{DBI_USER}, $ENV{DBI_PASS},
                                                                        
{RaiseError => 1, PrintError => 0, AutoCommit => 1});
                        };
-                       return $helpconnect, $@, undef if $@;
+                       if ($@) {
+                               ## Try one final time for Beastie
+                               if ($ENV{DBI_USER} ne 'postgres') {
+                                       $helpconnect += 8;
+                                       $ENV{DBI_USER} = 'postgres';
+                                       eval {
+                                               $dbh = 
DBI->connect($ENV{DBI_DSN}, $ENV{DBI_USER}, $ENV{DBI_PASS},
+                                                                               
        {RaiseError => 1, PrintError => 0, AutoCommit => 1});
+                                       };
+                               }
+                               return $helpconnect, $@, undef if $@;
+                       }
                }
        }
        if ($arg->{nosetup}) {

Reply via email to