mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
Don't assume PQdb() will return a valid result from a failed connection.
This commit is contained in:
@@ -61,8 +61,8 @@ main(int argc, char **argv)
|
||||
/* Check to see that the backend connection was successfully made */
|
||||
if (PQstatus(conn) != CONNECTION_OK)
|
||||
{
|
||||
fprintf(stderr, "Connection to database '%s' failed.\n", PQdb(conn));
|
||||
fprintf(stderr, "%s", PQerrorMessage(conn));
|
||||
fprintf(stderr, "Connection to database failed: %s",
|
||||
PQerrorMessage(conn));
|
||||
exit_nicely(conn);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user