diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-08-16 02:25:38 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-08-16 02:25:38 +0000 |
commit | 7eb9f613c3fdc33b2ea19177e7e0b210f38f194c (patch) | |
tree | f955d0aa43756fbea5bd548aa0656d4433919f8f /src | |
parent | 45b8e6ed687c7a7c595d116ecb6fe898041fd7c5 (diff) | |
download | postgresql-7eb9f613c3fdc33b2ea19177e7e0b210f38f194c.tar.gz postgresql-7eb9f613c3fdc33b2ea19177e7e0b210f38f194c.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_dump/pg_backup_db.c | 6 |
1 files 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); |