When doing `bucardo list databases`, don't show the psql port connection param unless...
authorGreg Sabino Mullane <greg@endpoint.com>
Sun, 20 Oct 2013 02:10:32 +0000 (22:10 -0400)
committerGreg Sabino Mullane <greg@endpoint.com>
Sun, 20 Oct 2013 02:10:32 +0000 (22:10 -0400)
bucardo

diff --git a/bucardo b/bucardo
index 59464b7a8b7aade9ed800545f683cf7c1855b361..95f6195bf1911c02c7cc3bee4a7919c960d45d0d 100755 (executable)
--- a/bucardo
+++ b/bucardo
@@ -1942,9 +1942,10 @@ sub list_databases {
             $showtypes ? $type : '',
             $maxstat, $info->{status};
         my $showhost = length $info->{dbhost} ? " -h $info->{dbhost}" : '';
+        my $showport = $info->{dbport} =~ /\d/ ? " -p $info->{dbport}" : '';
         my $dbtype = $info->{dbtype};
         if ($dbtype eq 'postgres') {
-            print "Conn: psql -p $info->{dbport} -U $info->{dbuser} -d $info->{dbname}$showhost";
+            print "Conn: psql$showport -U $info->{dbuser} -d $info->{dbname}$showhost";
             if (! $info->{server_side_prepares}) {
                 print ' (SSP is off)';
             }