Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

From: torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>, Damir Belyalov <dam(dot)bel07(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Danil Anisimow <anisimow(dot)d(at)gmail(dot)com>, Nikita Malakhov <HukuToc(at)gmail(dot)com>, a(dot)lepikhov(at)postgrespro(dot)ru, tgl(at)sss(dot)pgh(dot)pa(dot)us
Subject: Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)
Date: 2023-03-22 13:34:20
Message-ID: 8e5c596e47435e3b37b7a751ebcd9569@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2023-03-17 21:23, torikoshia wrote:
> On 2023-03-07 18:09, Daniel Gustafsson wrote:
>>> On 7 Mar 2023, at 09:35, Damir Belyalov <dam(dot)bel07(at)gmail(dot)com> wrote:
>>
>>> I felt just logging "Error: %ld" would make people wonder the meaning
>>> of
>>> the %ld. Logging something like ""Error: %ld data type errors were
>>> found" might be clearer.
>>>
>>> Thanks. For more clearance change the message to: "Errors were found:
>>> %".
>>
>> I'm not convinced that this adds enough clarity to assist the user.
>> We also
>> shouldn't use "error" in a WARNING log since the user has explicitly
>> asked to
>> skip rows on error, so it's not an error per se.
> +1
>
>> How about something like:
>>
>> ereport(WARNING,
>> (errmsg("%ld rows were skipped due to data type
>> incompatibility", cstate->ignored_errors),
>> errhint("Skipped rows can be inspected in the database log
>> for reprocessing.")));
> Since skipped rows cannot be inspected in the log when
> log_error_verbosity is set to terse,
> it might be better without this errhint.

Removed errhint.

Modified some codes since v3 couldn't be applied HEAD anymore.

Also modified v3 patch as below:

> 65 + if (cstate->opts.ignore_datatype_errors)
> 66 + cstate->ignored_errors = 0;
> 67 +

It seems not necessary since cstate is initialized by palloc0() in
BeginCopyFrom().

> 134 + ereport(LOG,
> 135 + errmsg("%s",
> cstate->escontext.error_data->message));
> 136 +
> 137 + return true;

Since LOG means 'Reports information of interest to administrators'
according to the manual[1], datatype error should not be logged as
LOG. I put it back in WARNING.

[1]
https://www.postgresql.org/docs/current/runtime-config-logging.html#RUNTIME-CONFIG-SEVERITY-LEVELS

--
Regards,

--
Atsushi Torikoshi
NTT DATA CORPORATION

Attachment Content-Type Size
v4-0001-Add-COPY-option-IGNORE_DATATYPE_ERRORS.patch text/x-diff 10.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2023-03-22 13:47:10 Re: Initial Schema Sync for Logical Replication
Previous Message Robert Haas 2023-03-22 13:19:18 Re: HOT chain validation in verify_heapam()