Proper output when a service is defined for a database (as seen via ./bucardo list...
authorGreg Sabino Mullane <greg@endpoint.com>
Wed, 6 Apr 2016 23:24:15 +0000 (19:24 -0400)
committerGreg Sabino Mullane <greg@endpoint.com>
Wed, 6 Apr 2016 23:24:15 +0000 (19:24 -0400)
bucardo

diff --git a/bucardo b/bucardo
index 2d5112a3b1de08c9f12100340f197e5020a2f21a..7d64f818e7278e009cbd99d045f11ecd67a25cb5 100755 (executable)
--- a/bucardo
+++ b/bucardo
@@ -2430,7 +2430,10 @@ sub list_databases {
         }
         my $dbtype = $info->{dbtype};
         if ($dbtype eq 'postgres') {
-            print "Conn: psql$showport -U $info->{dbuser} $dbname$showhost";
+            my $showuser = defined $info->{dbuser} ? "-U $info->{dbuser}" : '';
+            my $showdb = defined $info->{dbname} ? " -d $info->{dbname}" : '';
+            my $showservice = defined $info->{dbservice} ? qq{ "service=$info->{dbservice}"} : '';
+            print "Conn: psql$showport $showuser$showdb$showhost$showservice";
             if (! $info->{server_side_prepares}) {
                 print ' (SSP is off)';
             }