]> granicus.if.org Git - postgresql/commitdiff
In psql, if the is no connection object, e.g. due to a server crash,
authorBruce Momjian <bruce@momjian.us>
Wed, 15 Aug 2012 23:04:52 +0000 (19:04 -0400)
committerBruce Momjian <bruce@momjian.us>
Wed, 15 Aug 2012 23:05:05 +0000 (19:05 -0400)
require all parameters for \c, rather than using the defaults, which
might be wrong.

src/bin/psql/command.c

index 6ead800aeb1324c1078359dc00813ee8b5116fd7..2cd3ab4cf72d48691a04f2bb9333a58fadd8bfca 100644 (file)
@@ -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)