Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row

From: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row
Date: 2024-01-29 08:28:58
Message-ID: 20240129172858.ccb6c77c3be95a295e2b2b44@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 26 Jan 2024 08:08:29 -0700
"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> Hi,
>
> The option choice of "ignore" in the COPY ON_ERROR clause seems overly
> generic. There would seem to be two relevant ways to ignore bad column
> input data - drop the entire row or just set the column value to null. I
> can see us wanting to provide the set to null option and in any case having
> the option name be explicit that it ignores the row seems like a good idea.

I am not in favour of renaming the option name "ignore", instead we can
use another style of name for the option to set the column value to NULL,
for example, "set_to_null".

(Maybe, we can make a more generic option "set_to (col, val)" that can set
the value of column specified by "col" value to the specified value "val"
(e.g. 'N/A') on a soft error, although the syntax would be a bit complex...)

IMO, it is more simple to define "ignore" as to skip the entire row rather
than having variety of "ignore". Once defined it so, the option to set the
column value to NULL should not be called "ignore" because values in other
columns will be inserted.

Regards,
Yugo Nagata

>
> David J.

--
Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message o.tselebrovskiy 2024-01-29 08:47:31 Returning non-terminated string in ECPG Informix-compatible function
Previous Message Pavel Stehule 2024-01-29 07:57:42 Re: Schema variables - new implementation for Postgres 15