Skip to content

Commit ff2cc83

Browse files
committed
Provide the libpq error message when PQputline or PQendcopy fails.
1 parent 46a25ce commit ff2cc83

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/bin/pg_dump/pg_backup_db.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Implements the basic DB functions used by the archiver.
66
*
77
* IDENTIFICATION
8-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.67 2006/02/05 20:58:47 tgl Exp $
8+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.68 2006/02/09 18:28:29 tgl Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -389,7 +389,8 @@ _sendCopyLine(ArchiveHandle *AH, char *qry, char *eos)
389389
* to continue after an error in a COPY command.
390390
*/
391391
if (AH->pgCopyIn && PQputline(AH->connection, AH->pgCopyBuf->data) != 0)
392-
die_horribly(AH, modulename, "error returned by PQputline\n");
392+
die_horribly(AH, modulename, "error returned by PQputline: %s",
393+
PQerrorMessage(AH->connection));
393394

394395
resetPQExpBuffer(AH->pgCopyBuf);
395396

@@ -400,7 +401,8 @@ _sendCopyLine(ArchiveHandle *AH, char *qry, char *eos)
400401
if (isEnd)
401402
{
402403
if (AH->pgCopyIn && PQendcopy(AH->connection) != 0)
403-
die_horribly(AH, modulename, "error returned by PQendcopy\n");
404+
die_horribly(AH, modulename, "error returned by PQendcopy: %s",
405+
PQerrorMessage(AH->connection));
404406

405407
AH->pgCopyIn = false;
406408
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy