1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

make psql honor explicit database parameter in -l mode, in case "postgres" database is missing - per complaint from Philip Yarra.

This commit is contained in:
Andrew Dunstan
2005-11-17 23:49:44 +00:00
parent be324ad2ab
commit eed9eb446a

View File

@ -3,7 +3,7 @@
* *
* Copyright (c) 2000-2005, PostgreSQL Global Development Group * Copyright (c) 2000-2005, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.126 2005/10/27 13:34:47 momjian Exp $ * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.126.2.1 2005/11/17 23:49:44 adunstan Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
@ -206,7 +206,8 @@ main(int argc, char *argv[])
{ {
need_pass = false; need_pass = false;
pset.db = PQsetdbLogin(options.host, options.port, NULL, NULL, 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); username, password);
if (PQstatus(pset.db) == CONNECTION_BAD && if (PQstatus(pset.db) == CONNECTION_BAD &&