aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2021-02-04 17:40:33 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2021-02-04 17:40:33 +0200
commit2f86ab305e7fbc7b84960079551cf9cafd29684f (patch)
tree18861f4d59a0fbe8037d9024db5fbb04824c0216
parent3c78e0569ca04f4c92f0adcd74471398bb7b2e55 (diff)
downloadpostgresql-2f86ab305e7fbc7b84960079551cf9cafd29684f.tar.gz
postgresql-2f86ab305e7fbc7b84960079551cf9cafd29684f.zip
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.
-rw-r--r--src/backend/commands/copyfromparse.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/commands/copyfromparse.c b/src/backend/commands/copyfromparse.c
index 4c74067f849..b843d315b17 100644
--- a/src/backend/commands/copyfromparse.c
+++ b/src/backend/commands/copyfromparse.c
@@ -386,7 +386,7 @@ CopyLoadRawBuf(CopyFromState cstate)
cstate->raw_buf[nbytes] = '\0';
cstate->raw_buf_index = 0;
cstate->raw_buf_len = nbytes;
- cstate->bytes_processed += nbytes;
+ cstate->bytes_processed += inbytes;
pgstat_progress_update_param(PROGRESS_COPY_BYTES_PROCESSED, cstate->bytes_processed);
return (inbytes > 0);
}