Provide the libpq error message when PQputline or PQendcopy fails.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 9 Feb 2006 18:28:43 +0000 (18:28 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 9 Feb 2006 18:28:43 +0000 (18:28 +0000)
src/bin/pg_dump/pg_backup_db.c

index 8135e50ae192321f35c2b3ca5e6051563197887d..b417128111f92705902b29612145827870097f03 100644 (file)
@@ -5,7 +5,7 @@
  * Implements the basic DB functions used by the archiver.
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.61.4.2 2006/02/05 20:59:06 tgl Exp $
+ *   $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.61.4.3 2006/02/09 18:28:43 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -407,7 +407,8 @@ _sendCopyLine(ArchiveHandle *AH, char *qry, char *eos)
     */
 
    if (AH->pgCopyIn && PQputline(AH->connection, AH->pgCopyBuf->data) != 0)
-       die_horribly(AH, modulename, "error returned by PQputline\n");
+       die_horribly(AH, modulename, "error returned by PQputline: %s",
+                    PQerrorMessage(AH->connection));
 
    resetPQExpBuffer(AH->pgCopyBuf);
 
@@ -418,7 +419,8 @@ _sendCopyLine(ArchiveHandle *AH, char *qry, char *eos)
    if (isEnd)
    {
        if (AH->pgCopyIn && PQendcopy(AH->connection) != 0)
-           die_horribly(AH, modulename, "error returned by PQendcopy\n");
+           die_horribly(AH, modulename, "error returned by PQendcopy: %s",
+                        PQerrorMessage(AH->connection));
 
        AH->pgCopyIn = false;
    }