]> granicus.if.org Git - postgresql/commitdiff
Must print server's failure message before trying reconnect, not after.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 4 Aug 2003 19:10:40 +0000 (19:10 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 4 Aug 2003 19:10:40 +0000 (19:10 +0000)
src/bin/psql/common.c

index 8bfa3aa139ff48989ea6c12df9d6a509ea73df32..f9e53ec3b4d1e3b1a36190a6b0736bc7904c4f39 100644 (file)
@@ -3,7 +3,7 @@
  *
  * 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 "common.h"
@@ -247,7 +247,7 @@ ConnectionUp()
  * with a code of EXIT_BADCONN.
  */
 static bool
-CheckConnection()
+CheckConnection(void)
 {
        bool            OK;
 
@@ -344,8 +344,8 @@ AcceptResult(const PGresult *result)
 
        if (!OK)
        {
-               CheckConnection();
                psql_error("%s", PQerrorMessage(pset.db));
+               CheckConnection();
        }
 
        return OK;
@@ -514,7 +514,8 @@ PrintQueryResults(PGresult *results,
                                        if (pset.popt.topt.format == PRINT_HTML)
                                        {
                                                fputs("<p>", pset.queryFout);
-                                               html_escaped_print(PQcmdStatus(results), pset.queryFout);
+                                               html_escaped_print(PQcmdStatus(results),
+                                                                                  pset.queryFout);
                                                fputs("</p>\n", pset.queryFout);
                                        }
                                        else
@@ -542,6 +543,7 @@ PrintQueryResults(PGresult *results,
 
        fflush(pset.queryFout);
 
+       /* may need this to recover from conn loss during COPY */
        if (!CheckConnection())
                return false;