postgres.git / summary / log / commit / refs
commit 7eb9f613c3fdc33b2ea19177e7e0b210f38f194c
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Sat Aug 16 02:25:38 2008 +0000
First released in: 8.4.0, 7.4.22, 8.0.18, 8.1.14, 8.2.10, 8.3.4
Fix pg_dump/pg_restore's ExecuteSqlCommand() to behave suitably if PQexec
returns NULL instead of a PGresult. The former coding would fail, which
is OK, but it neglected to give you the PQerrorMessage that might tell
you why. In the oldest branches, there was another problem: it'd sometimes
report PQerrorMessage from the wrong connection.
src/bin/pg_dump/pg_backup_db.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c
index cab9d7830ba..b548f2c56df 100644
--- a/src/bin/pg_dump/pg_backup_db.c
+++ b/src/bin/pg_dump/pg_backup_db.c
@@ -5,7 +5,7 @@
* Implements the basic DB functions used by the archiver.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.50 2003/10/03 20:10:59 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.50.2.1 2008/08/16 02:25:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -303,8 +303,6 @@ _executeSqlCommand(ArchiveHandle *AH, PGconn *conn, PQExpBuffer qry, char *desc)
/* fprintf(stderr, "Executing: '%s'\n\n", qry->data); */
res = PQexec(conn, qry->data);
- if (!res)
- die_horribly(AH, modulename, "%s: no result from server\n", desc);
if (PQresultStatus(res) != PGRES_COMMAND_OK && PQresultStatus(res) != PGRES_TUPLES_OK)
{
@@ -317,7 +315,7 @@ _executeSqlCommand(ArchiveHandle *AH, PGconn *conn, PQExpBuffer qry, char *desc)
}
else
die_horribly(AH, modulename, "%s: %s",
- desc, PQerrorMessage(AH->connection));
+ desc, PQerrorMessage(conn));
}
PQclear(res);
[parent: 45b8e6ed687c]