Avoid crashing pg_dump if we can't connect to the database server, and
authorNeil Conway <neilc@samurai.com>
Wed, 27 Jul 2005 05:15:03 +0000 (05:15 +0000)
committerNeil Conway <neilc@samurai.com>
Wed, 27 Jul 2005 05:15:03 +0000 (05:15 +0000)
no database has been explicitly specified. Per gripe from Omar Kilani.

src/bin/pg_dump/pg_backup_db.c

index 9df17243aa1e6fdb552a298adbc461754039611e..b412cf0e0522abaa07995b40aae0eaf9954a59b5 100644 (file)
@@ -267,7 +267,7 @@ ConnectDatabase(Archive *AHX,
        /* check to see that the backend connection was successfully made */
        if (PQstatus(AH->connection) == CONNECTION_BAD)
                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_database_version(AH, ignoreVersion);