Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 17d6721

Browse files
committed
Must print server's failure message before trying reconnect, not after.
1 parent e627dd2 commit 17d6721

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/bin/psql/common.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.68 2003/08/04 00:43:29 momjian Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.69 2003/08/04 19:10:40 tgl Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "common.h"
@@ -247,7 +247,7 @@ ConnectionUp()
247247
* with a code of EXIT_BADCONN.
248248
*/
249249
static bool
250-
CheckConnection()
250+
CheckConnection(void)
251251
{
252252
bool OK;
253253

@@ -344,8 +344,8 @@ AcceptResult(const PGresult *result)
344344

345345
if (!OK)
346346
{
347-
CheckConnection();
348347
psql_error("%s", PQerrorMessage(pset.db));
348+
CheckConnection();
349349
}
350350

351351
return OK;
@@ -514,7 +514,8 @@ PrintQueryResults(PGresult *results,
514514
if (pset.popt.topt.format == PRINT_HTML)
515515
{
516516
fputs("<p>", pset.queryFout);
517-
html_escaped_print(PQcmdStatus(results), pset.queryFout);
517+
html_escaped_print(PQcmdStatus(results),
518+
pset.queryFout);
518519
fputs("</p>\n", pset.queryFout);
519520
}
520521
else
@@ -542,6 +543,7 @@ PrintQueryResults(PGresult *results,
542543

543544
fflush(pset.queryFout);
544545

546+
/* may need this to recover from conn loss during COPY */
545547
if (!CheckConnection())
546548
return false;
547549

0 commit comments

Comments
 (0)