Also print the libpq error message when lo_create or lo_open fails

This commit is contained in:
Peter Eisentraut 2010-03-18 20:00:51 +00:00
parent a401226bd8
commit 2827516394
2 changed files with 8 additions and 8 deletions

View file

@ -15,7 +15,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.182 2010/02/26 02:01:16 momjian Exp $ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.183 2010/03/18 20:00:51 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -935,13 +935,13 @@ StartRestoreBlob(ArchiveHandle *AH, Oid oid, bool drop)
{ {
loOid = lo_create(AH->connection, oid); loOid = lo_create(AH->connection, oid);
if (loOid == 0 || loOid != oid) if (loOid == 0 || loOid != oid)
die_horribly(AH, modulename, "could not create large object %u\n", die_horribly(AH, modulename, "could not create large object %u: %s",
oid); oid, PQerrorMessage(AH->connection));
} }
AH->loFd = lo_open(AH->connection, oid, INV_WRITE); AH->loFd = lo_open(AH->connection, oid, INV_WRITE);
if (AH->loFd == -1) if (AH->loFd == -1)
die_horribly(AH, modulename, "could not open large object %u\n", die_horribly(AH, modulename, "could not open large object %u: %s",
oid); oid, PQerrorMessage(AH->connection));
} }
else else
{ {

View file

@ -25,7 +25,7 @@
* http://archives.postgresql.org/pgsql-bugs/2010-02/msg00187.php * http://archives.postgresql.org/pgsql-bugs/2010-02/msg00187.php
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.578 2010/03/11 04:36:43 tgl Exp $ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.579 2010/03/18 20:00:51 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -2117,7 +2117,7 @@ dumpBlobs(Archive *AH, void *arg)
loFd = lo_open(g_conn, blobOid, INV_READ); loFd = lo_open(g_conn, blobOid, INV_READ);
if (loFd == -1) if (loFd == -1)
{ {
write_msg(NULL, "dumpBlobs(): could not open large object %u: %s", write_msg(NULL, "could not open large object %u: %s",
blobOid, PQerrorMessage(g_conn)); blobOid, PQerrorMessage(g_conn));
exit_nicely(); exit_nicely();
} }
@ -2130,7 +2130,7 @@ dumpBlobs(Archive *AH, void *arg)
cnt = lo_read(g_conn, loFd, buf, LOBBUFSIZE); cnt = lo_read(g_conn, loFd, buf, LOBBUFSIZE);
if (cnt < 0) if (cnt < 0)
{ {
write_msg(NULL, "dumpBlobs(): error reading large object %u: %s", write_msg(NULL, "error reading large object %u: %s",
blobOid, PQerrorMessage(g_conn)); blobOid, PQerrorMessage(g_conn));
exit_nicely(); exit_nicely();
} }