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

Поиск
Список
Период
Сортировка
От jian he
Тема Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row
Дата
Msg-id CACJufxExhY9P8a-rk21wR2NXF-UydMjictyiKiMMi_Z4iX6gNQ@mail.gmail.com
обсуждение исходный текст
Ответ на Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-hackers
On Fri, Jan 26, 2024 at 11:09 PM David G. Johnston
<david.g.johnston@gmail.com> wrote:
>
> Hi,
>
> The option choice of "ignore" in the COPY ON_ERROR clause seems overly generic.  There would seem to be two relevant
waysto ignore bad column input data - drop the entire row or just set the column value to null.  I can see us wanting
toprovide the set to null option and in any case having the option name be explicit that it ignores the row seems like
agood idea. 

two issue I found out while playing around with it;
create table x1(a int not null, b int not null );

you can only do:
COPY x1 from stdin (on_error 'null');
but you cannot do
COPY x1 from stdin (on_error null);
we need to hack the gram.y to escape the "null". I don't know how to
make it work.
related post I found:
https://stackoverflow.com/questions/31786611/how-to-escape-flex-keyword

another issue:
COPY x1 from stdin (on_error null);

when we already have `not null` top level constraint for table x1.
Do we need an error immediately?
"on_error null" seems to conflict with `not null` constraint (assume
refers to the same column).
it may fail while doing bulk inserts while on_error is set to null
because of violating a not null constraint.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Steele
Дата:
Сообщение: Re: Add recovery to pg_control and remove backup_label
Следующее
От: jian he
Дата:
Сообщение: Re: SQL:2011 application time