Add new COPY option SAVE_ERROR_TO
authorAlexander Korotkov <[email protected]>
Tue, 16 Jan 2024 21:08:53 +0000 (23:08 +0200)
committerAlexander Korotkov <[email protected]>
Tue, 16 Jan 2024 21:08:53 +0000 (23:08 +0200)
commit9e2d8701194fa1d280b73c024759950c74c1c637
treeb9da06ab1181dec26d64848555f546c7d7d0e231
parentc7e5e994b2eb07cd0f3d5f0bb320e981bf1aae6e
Add new COPY option SAVE_ERROR_TO

Currently, when source data contains unexpected data regarding data type or
range, the entire COPY fails. However, in some cases, such data can be ignored
and just copying normal data is preferable.

This commit adds a new option SAVE_ERROR_TO, which specifies where to save the
error information. When this option is specified, COPY skips soft errors and
continues copying.

Currently, SAVE_ERROR_TO only supports "none". This indicates error information
is not saved and COPY just skips the unexpected data and continues running.

Later works are expected to add more choices, such as 'log' and 'table'.

Author: Damir Belyalov, Atsushi Torikoshi, Alex Shulgin, Jian He
Discussion: https://postgr.es/m/87k31ftoe0.fsf_-_%40commandprompt.com
Reviewed-by: Pavel Stehule, Andres Freund, Tom Lane, Daniel Gustafsson,
Reviewed-by: Alena Rybakina, Andy Fan, Andrei Lepikhov, Masahiko Sawada
Reviewed-by: Vignesh C, Atsushi Torikoshi
doc/src/sgml/ref/copy.sgml
src/backend/commands/copy.c
src/backend/commands/copyfrom.c
src/backend/commands/copyfromparse.c
src/bin/psql/tab-complete.c
src/include/commands/copy.h
src/include/commands/copyfrom_internal.h
src/test/regress/expected/copy2.out
src/test/regress/sql/copy2.sql
src/tools/pgindent/typedefs.list