pgsql: Add REJECT_LIMIT option to the COPY command.

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add REJECT_LIMIT option to the COPY command.
Date: 2024-10-08 09:23:00
Message-ID: E1sy6Qm-002fZF-EW@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4ac2a9beceb10d44806d2cf157d5a931bdade39e

Modified Files
--------------
doc/src/sgml/ref/copy.sgml | 19 +++++++++++++++++++
src/backend/commands/copy.c | 33 +++++++++++++++++++++++++++++++++
src/backend/commands/copyfrom.c | 7 +++++++
src/include/commands/copy.h | 1 +
src/test/regress/expected/copy2.out | 10 ++++++++++
src/test/regress/sql/copy2.sql | 21 +++++++++++++++++++++
6 files changed, 91 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2024-10-08 09:26:07 pgsql: Move check for binary mode and on_error option to the appropriat
Previous Message Amit Kapila 2024-10-08 07:10:58 pgsql: Stabilize the test added by commit 022564f60c.