From 4ac2a9beceb10d44806d2cf157d5a931bdade39e Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Tue, 8 Oct 2024 18:19:58 +0900 Subject: Add REJECT_LIMIT option to the COPY command. Previously, when ON_ERROR was set to 'ignore', the COPY command would skip all rows with data type conversion errors, with no way to limit the number of skipped rows before failing. This commit introduces the REJECT_LIMIT option, allowing users to specify the maximum number of erroneous rows that can be skipped. If more rows encounter data type conversion errors than allowed by REJECT_LIMIT, the COPY command will fail with an error, even when ON_ERROR = 'ignore'. Author: Atsushi Torikoshi Reviewed-by: Junwang Zhao, Kirill Reshke, jian he, Fujii Masao Discussion: https://postgr.es/m/63f99327aa6b404cc951217fa3e61fe4@oss.nttdata.com --- doc/src/sgml/ref/copy.sgml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml index b9413d48925..f493ddb371d 100644 --- a/doc/src/sgml/ref/copy.sgml +++ b/doc/src/sgml/ref/copy.sgml @@ -44,6 +44,7 @@ COPY { table_name [ ( column_name [, ...] ) | * } FORCE_NULL { ( column_name [, ...] ) | * } ON_ERROR error_action + REJECT_LIMIT maxerror ENCODING 'encoding_name' LOG_VERBOSITY verbosity @@ -413,6 +414,24 @@ COPY { table_name [ ( + + REJECT_LIMIT + + + Specifies the maximum number of errors tolerated while converting a + column's input value to its data type, when ON_ERROR is + set to ignore. + If the input causes more errors than the specified value, the COPY + command fails, even with ON_ERROR set to ignore. + This clause must be used with ON_ERROR=ignore + and maxerror must be positive bigint. + If not specified, ON_ERROR=ignore + allows an unlimited number of errors, meaning COPY will + skip all erroneous data. + + + + ENCODING -- cgit v1.2.3