Commit a43bbe34 authored by Neil Conway's avatar Neil Conway

Avoid crashing pg_dump if we can't connect to the database server, and

no database has been explicitly specified. Per gripe from Omar Kilani.
parent 58d214e5
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Implements the basic DB functions used by the archiver. * Implements the basic DB functions used by the archiver.
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.63 2005/07/01 21:03:25 momjian Exp $ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.64 2005/07/27 05:14:12 neilc Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -266,7 +266,7 @@ ConnectDatabase(Archive *AHX, ...@@ -266,7 +266,7 @@ ConnectDatabase(Archive *AHX,
/* check to see that the backend connection was successfully made */ /* check to see that the backend connection was successfully made */
if (PQstatus(AH->connection) == CONNECTION_BAD) if (PQstatus(AH->connection) == CONNECTION_BAD)
die_horribly(AH, modulename, "connection to database \"%s\" failed: %s", die_horribly(AH, modulename, "connection to database \"%s\" failed: %s",
dbname, PQerrorMessage(AH->connection)); PQdb(AH->connection), PQerrorMessage(AH->connection));
/* check for version mismatch */ /* check for version mismatch */
_check_database_version(AH, ignoreVersion); _check_database_version(AH, ignoreVersion);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment