Provide the libpq error message when PQputline or PQendcopy fails.
authorTom Lane <[email protected]>
Thu, 9 Feb 2006 18:28:43 +0000 (18:28 +0000)
committerTom Lane <[email protected]>
Thu, 9 Feb 2006 18:28:43 +0000 (18:28 +0000)
src/bin/pg_dump/pg_backup_db.c

index 2d49cbed1fe34f901efe9fd04bf33b368154686c..67a481a56e07d94e2ecb871f93d921383ed89f4c 100644 (file)
@@ -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;
        }