make psql honor explicit database parameter in -l mode, in case "postgres" database...
authorAndrew Dunstan <[email protected]>
Thu, 17 Nov 2005 23:49:44 +0000 (23:49 +0000)
committerAndrew Dunstan <[email protected]>
Thu, 17 Nov 2005 23:49:44 +0000 (23:49 +0000)
src/bin/psql/startup.c

index 90b0c53cb4053c3e0d6478a53708c5ffc1340e0f..27834e3eff2dbdd87b2a67415a4acc1d031e934b 100644 (file)
@@ -206,7 +206,8 @@ main(int argc, char *argv[])
        {
                need_pass = false;
                pset.db = PQsetdbLogin(options.host, options.port, NULL, NULL,
-                                options.action == ACT_LIST_DB ? "postgres" : options.dbname,
+                                options.action == ACT_LIST_DB && options.dbname == NULL ? 
+                                                          "postgres" : options.dbname,
                                                           username, password);
 
                if (PQstatus(pset.db) == CONNECTION_BAD &&