mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Add progress reporting of skipped tuples during COPY FROM.
9e2d870119
enabled the COPY command to skip malformed data, however
there was no visibility into how many tuples were actually skipped
during the COPY FROM.
This commit adds a new "tuples_skipped" column to
pg_stat_progress_copy view to report the number of tuples that were
skipped because they contain malformed data.
Bump catalog version.
Author: Atsushi Torikoshi
Reviewed-by: Masahiko Sawada
Discussion: https://postgr.es/m/d12fd8c99adcae2744212cb23feff6ed%40oss.nttdata.com
This commit is contained in:
@ -650,6 +650,7 @@ CopyFrom(CopyFromState cstate)
|
||||
CopyMultiInsertInfo multiInsertInfo = {0}; /* pacify compiler */
|
||||
int64 processed = 0;
|
||||
int64 excluded = 0;
|
||||
int64 skipped = 0;
|
||||
bool has_before_insert_row_trig;
|
||||
bool has_instead_insert_row_trig;
|
||||
bool leafpart_use_multi_insert = false;
|
||||
@ -1012,6 +1013,10 @@ CopyFrom(CopyFromState cstate)
|
||||
*/
|
||||
cstate->escontext->error_occurred = false;
|
||||
|
||||
/* Report that this tuple was skipped by the ON_ERROR clause */
|
||||
pgstat_progress_update_param(PROGRESS_COPY_TUPLES_SKIPPED,
|
||||
++skipped);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user