From fe21fcaf8d91a71c15ff25276f9fa81e0cd1dba9 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Wed, 15 Aug 2012 19:04:52 -0400 Subject: [PATCH] In psql, if the is no connection object, e.g. due to a server crash, require all parameters for \c, rather than using the defaults, which might be wrong. --- src/bin/psql/command.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 6ead800aeb..2cd3ab4cf7 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -1512,6 +1512,12 @@ do_connect(char *dbname, char *user, char *host, char *port) *n_conn; char *password = NULL; + if (!o_conn && (!dbname || !user || !host || !port)) + { + fputs(_("All connection parameters must be supplied because no database connection exists\n"), stderr); + return false; + } + if (!dbname) dbname = PQdb(o_conn); if (!user)