Commit 17d6721e authored by Tom Lane's avatar Tom Lane

Must print server's failure message before trying reconnect, not after.

parent e627dd2d
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright 2000 by PostgreSQL Global Development Group * Copyright 2000 by PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.68 2003/08/04 00:43:29 momjian Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.69 2003/08/04 19:10:40 tgl Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "common.h" #include "common.h"
...@@ -247,7 +247,7 @@ ConnectionUp() ...@@ -247,7 +247,7 @@ ConnectionUp()
* with a code of EXIT_BADCONN. * with a code of EXIT_BADCONN.
*/ */
static bool static bool
CheckConnection() CheckConnection(void)
{ {
bool OK; bool OK;
...@@ -344,8 +344,8 @@ AcceptResult(const PGresult *result) ...@@ -344,8 +344,8 @@ AcceptResult(const PGresult *result)
if (!OK) if (!OK)
{ {
CheckConnection();
psql_error("%s", PQerrorMessage(pset.db)); psql_error("%s", PQerrorMessage(pset.db));
CheckConnection();
} }
return OK; return OK;
...@@ -514,7 +514,8 @@ PrintQueryResults(PGresult *results, ...@@ -514,7 +514,8 @@ PrintQueryResults(PGresult *results,
if (pset.popt.topt.format == PRINT_HTML) if (pset.popt.topt.format == PRINT_HTML)
{ {
fputs("<p>", pset.queryFout); fputs("<p>", pset.queryFout);
html_escaped_print(PQcmdStatus(results), pset.queryFout); html_escaped_print(PQcmdStatus(results),
pset.queryFout);
fputs("</p>\n", pset.queryFout); fputs("</p>\n", pset.queryFout);
} }
else else
...@@ -542,6 +543,7 @@ PrintQueryResults(PGresult *results, ...@@ -542,6 +543,7 @@ PrintQueryResults(PGresult *results,
fflush(pset.queryFout); fflush(pset.queryFout);
/* may need this to recover from conn loss during COPY */
if (!CheckConnection()) if (!CheckConnection())
return false; return false;
......
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