Index: src/bin/pg_dump/pg_backup_db.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v retrieving revision 1.66 diff -c -r1.66 pg_backup_db.c *** src/bin/pg_dump/pg_backup_db.c 15 Oct 2005 02:49:38 -0000 1.66 --- src/bin/pg_dump/pg_backup_db.c 20 Jan 2006 20:05:33 -0000 *************** *** 306,311 **** --- 306,315 ---- } else { + /* Catch that this is a failed copy command, and + * set pgCopyIn accordingly */ + if (strncasecmp(qry->data,"COPY ",5) == 0) AH->pgCopyIn = -1; + strncpy(errStmt, qry->data, DB_MAX_ERR_STMT); if (errStmt[DB_MAX_ERR_STMT - 1] != '\0') { *************** *** 389,395 **** *--------- */ ! if (PQputline(AH->connection, AH->pgCopyBuf->data) != 0) die_horribly(AH, modulename, "error returned by PQputline\n"); resetPQExpBuffer(AH->pgCopyBuf); --- 393,401 ---- *--------- */ ! /* If this is a failed copy command (pgCopyIn == -1) then just ! * fall through */ ! if (AH->pgCopyIn == 1 && PQputline(AH->connection, AH->pgCopyBuf->data) != 0) die_horribly(AH, modulename, "error returned by PQputline\n"); resetPQExpBuffer(AH->pgCopyBuf); *************** *** 400,406 **** if (isEnd) { ! if (PQendcopy(AH->connection) != 0) die_horribly(AH, modulename, "error returned by PQendcopy\n"); AH->pgCopyIn = 0; --- 406,414 ---- if (isEnd) { ! /* If this is a failed copy command (pgCopyIn == -1) then just ! * fall through */ ! if (AH->pgCopyIn == 1 && PQendcopy(AH->connection) != 0) die_horribly(AH, modulename, "error returned by PQendcopy\n"); AH->pgCopyIn = 0; *************** *** 615,621 **** /* Could switch between command and COPY IN mode at each line */ while (qry < eos) { ! if (AH->pgCopyIn) qry = _sendCopyLine(AH, qry, eos); else qry = _sendSQLLine(AH, qry, eos); --- 623,633 ---- /* Could switch between command and COPY IN mode at each line */ while (qry < eos) { ! /* If this is a working COPY *or* a failed COPY, call ! * _sendCopyLine to handle the incoming data from the COPY ! * command, it will just circular-file the data if we're ! * running a failed COPY. */ ! if (AH->pgCopyIn == 1 || AH->pgCopyIn == -1) qry = _sendCopyLine(AH, qry, eos); else qry = _sendSQLLine(AH, qry, eos);