Skip to content

Commit 2f86ab3

Browse files
committed
Fix small error in COPY FROM progress reporting.
The # of bytes processed was accumulated slightly incorrectly. After loading more data to the input buffer, we added the number of bytes in the buffer to the sum. But in case of multi-byte characters or escapes, there can be a few unprocessed bytes left over from previous load in the buffer. Those bytes got counted twice.
1 parent 3c78e05 commit 2f86ab3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/commands/copyfromparse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ CopyLoadRawBuf(CopyFromState cstate)
386386
cstate->raw_buf[nbytes] = '\0';
387387
cstate->raw_buf_index = 0;
388388
cstate->raw_buf_len = nbytes;
389-
cstate->bytes_processed += nbytes;
389+
cstate->bytes_processed += inbytes;
390390
pgstat_progress_update_param(PROGRESS_COPY_BYTES_PROCESSED, cstate->bytes_processed);
391391
return (inbytes > 0);
392392
}

0 commit comments

Comments
 (0)