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

index 29ed7f9d8ffd332c26a97afb0b1b61f1aaa5af38..1b4f484bc2b549fee56582ab4b05c3dc5bfa09c3 100644 (file)
@@ -389,7 +389,8 @@ _sendCopyLine(ArchiveHandle *AH, char *qry, char *eos)
         * to continue after an error in a COPY command.
         */
        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);
 
@@ -400,7 +401,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;
        }