diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
new file mode 100644
index 6ead800..2cd3ab4
*** a/src/bin/psql/command.c
--- b/src/bin/psql/command.c
*************** do_connect(char *dbname, char *user, cha
*** 1512,1517 ****
--- 1512,1523 ----
  			   *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)
