Re: Add new COPY option REJECT_LIMIT

2024-10-08 Thread torikoshia
On 2024-10-08 18:39, Fujii Masao wrote: On 2024/10/07 21:51, torikoshia wrote: While reviewing, I also noticed that the check for "opts_out->binary && opts_out->on_error != COPY_ON_ERROR_STOP" is similarly placed before setting the defaults, which might not be correct. This check should probably

Re: Add new COPY option REJECT_LIMIT

2024-10-08 Thread Fujii Masao
On 2024/10/07 21:51, torikoshia wrote: While reviewing, I also noticed that the check for "opts_out->binary && opts_out->on_error != COPY_ON_ERROR_STOP" is similarly placed before setting the defaults, which might not be correct. This check should probably be moved as well. Additionally, the c

Re: Add new COPY option REJECT_LIMIT

2024-10-07 Thread torikoshia
Thanks for your review! On Thu, Oct 3, 2024 at 4:27 PM jian he wrote: mentioning maxerror is a bigint type or explicitly mentioning the maximum allowed value of "maxerror" would be great. Added a description that it allows positive bigint. On Thu, Oct 3, 2024 at 11:43 PM Fujii Masao w

Re: Add new COPY option REJECT_LIMIT

2024-10-03 Thread Fujii Masao
On 2024/09/30 21:08, torikoshia wrote: Since defGetInt64() checks not only whether the input value exceeds the range of bigint but also input value is specified, attached v6 patch checks them by directly calling defGetInt64(). Thanks for updating the patch! But the patch no longer applied

Re: Add new COPY option REJECT_LIMIT

2024-10-03 Thread jian he
> I'm wondering if we can use the wording maxerror as in the attached > patch. > + +REJECT_LIMIT + + + Specifies the maximum number of errors tolerated while converting a + column's input value to its data type, when ON_ERROR is + set to ignore. + If the input c

Re: Add new COPY option REJECT_LIMIT

2024-09-30 Thread torikoshia
On 2024-09-28 10:48, Jian he wrote: Thanks for your comments! +/* + * Extract REJECT_LIMIT value from a DefElem. + */ +static int64 +defGetCopyRejectLimitOptions(DefElem *def) +{ + int64 reject_limit; + + if (def->arg == NULL) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("REJECT_

Re: Add new COPY option REJECT_LIMIT

2024-09-27 Thread jian he
+/* + * Extract REJECT_LIMIT value from a DefElem. + */ +static int64 +defGetCopyRejectLimitOptions(DefElem *def) +{ + int64 reject_limit; + + if (def->arg == NULL) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("REJECT_LIMIT requires a positive integer"))); + + if (nodeTag(def->arg) =

Re: Add new COPY option REJECT_LIMIT

2024-09-26 Thread torikoshia
On 2024-09-25 02:22, Fujii Masao wrote: Thanks for your review! Attached v5 patch. On 2024/09/24 14:25, torikoshia wrote: Updated the patch. Thanks for updating the patch! +REJECT_LIMIT { class="parameter">integer } The curly braces {} seem unnecessary here. + When a positive in

Re: Add new COPY option REJECT_LIMIT

2024-09-24 Thread Fujii Masao
On 2024/09/24 14:25, torikoshia wrote: Updated the patch. Thanks for updating the patch! +REJECT_LIMIT { integer } The curly braces {} seem unnecessary here. + When a positive integer value is specified, COPY limits + the maximum tolerable number of errors while converting

Re: Add new COPY option REJECT_LIMIT

2024-09-23 Thread torikoshia
Updated the patch. On 2024-07-23 23:06, torikoshia wrote: On Tue, Jul 23, 2024 at 1:35 PM Fujii Masao wrote: Thanks for your review. On 2024/07/22 21:37, torikoshia wrote: On Fri, Jul 19, 2024 at 11:48 PM Junwang Zhao wrote: Thanks for the comment. In patch 0002, the ratio is calculate

Re: Add new COPY option REJECT_LIMIT

2024-07-23 Thread torikoshia
On 2024-07-23 02:06, Kirill Reshke wrote: Thanks for your review. Few comments: + When a positive integer value is specified, COPY limits + the maximum tolerable number of errors while converting a column's input + value into its data type. If nothing is specified, then the

Re: Add new COPY option REJECT_LIMIT

2024-07-23 Thread torikoshia
On Tue, Jul 23, 2024 at 1:35 PM Fujii Masao wrote: Thanks for your review. On 2024/07/22 21:37, torikoshia wrote: On Fri, Jul 19, 2024 at 11:48 PM Junwang Zhao wrote: Thanks for the comment. In patch 0002, the ratio is calculated by the already skipped/processed rows, but what if a user

Re: Add new COPY option REJECT_LIMIT

2024-07-22 Thread Fujii Masao
On 2024/07/22 21:37, torikoshia wrote: On Fri, Jul 19, 2024 at 11:48 PM Junwang Zhao wrote: Thanks for the comment. In patch 0002, the ratio is calculated by the already skipped/processed rows, but what if a user wants to copy 1000 rows, and he/she can tolerate 10 error rows, so he/she migh

Re: Add new COPY option REJECT_LIMIT

2024-07-22 Thread Kirill Reshke
Hi! Nice feature. Few comments: > + When a positive integer value is specified, COPY > limits > + the maximum tolerable number of errors while converting a column's > input > + value into its data type. If nothing is specified, then the maximum tolerable number of errors is one,

Re: Add new COPY option REJECT_LIMIT

2024-07-22 Thread torikoshia
On Fri, Jul 19, 2024 at 11:48 PM Junwang Zhao wrote: Thanks for the comment. In patch 0002, the ratio is calculated by the already skipped/processed rows, but what if a user wants to copy 1000 rows, and he/she can tolerate 10 error rows, so he/she might set *reject_limit 0.01*, but one bad row

Re: Add new COPY option REJECT_LIMIT

2024-07-19 Thread Fujii Masao
On 2024/07/19 22:03, Fujii Masao wrote: On 2024/07/17 22:21, torikoshia wrote: On 2024-07-03 02:07, Fujii Masao wrote: However, if we support REJECT_LIMIT, I'm not sure if the ON_ERROR option is still necessary. I remembered another reason for the necessity of ON_ERROR. ON_ERROR define

Re: Add new COPY option REJECT_LIMIT

2024-07-19 Thread Junwang Zhao
Hi Torikoshia, On Wed, Jul 17, 2024 at 9:21 PM torikoshia wrote: > > On 2024-07-03 02:07, Fujii Masao wrote: > > However, if we support REJECT_LIMIT, I'm not sure if the ON_ERROR > > option is still necessary. > > I remembered another reason for the necessity of ON_ERROR. > > ON_ERROR defines how

Re: Add new COPY option REJECT_LIMIT

2024-07-19 Thread Fujii Masao
On 2024/07/17 22:21, torikoshia wrote: On 2024-07-03 02:07, Fujii Masao wrote: However, if we support REJECT_LIMIT, I'm not sure if the ON_ERROR option is still necessary. I remembered another reason for the necessity of ON_ERROR. ON_ERROR defines how to behave when encountering an error

Re: Add new COPY option REJECT_LIMIT

2024-07-17 Thread torikoshia
On 2024-07-03 02:07, Fujii Masao wrote: However, if we support REJECT_LIMIT, I'm not sure if the ON_ERROR option is still necessary. I remembered another reason for the necessity of ON_ERROR. ON_ERROR defines how to behave when encountering an error and it just accepts 'ignore' and 'stop' cur

Re: Add new COPY option REJECT_LIMIT

2024-07-05 Thread torikoshia
On 2024-07-05 12:59, Fujii Masao wrote: On 2024/07/04 12:05, torikoshia wrote: I'm going to update it after discussing the option format as described below. Thanks! I agree that it's possible to use only REJECT_LIMIT without ON_ERROR. I also think it's easy to understand that REJECT_LIMIT=0

Re: Add new COPY option REJECT_LIMIT

2024-07-04 Thread Fujii Masao
On 2024/07/04 12:05, torikoshia wrote: I'm going to update it after discussing the option format as described below. Thanks! I agree that it's possible to use only REJECT_LIMIT without ON_ERROR. I also think it's easy to understand that REJECT_LIMIT=0 is ON_ERROR=stop. However, expressing

Re: Add new COPY option REJECT_LIMIT

2024-07-03 Thread torikoshia
On 2024-07-03 02:07, Fujii Masao wrote: Thanks for your comments! On 2024/01/26 18:49, torikoshia wrote: Hi, 9e2d870 enabled the COPY command to skip soft error, and I think we can add another option which specifies the maximum tolerable number of soft errors. I remember this was discussed

Re: Add new COPY option REJECT_LIMIT

2024-07-02 Thread Fujii Masao
On 2024/01/26 18:49, torikoshia wrote: Hi, 9e2d870 enabled the COPY command to skip soft error, and I think we can add another option which specifies the maximum tolerable number of soft errors. I remember this was discussed in [1], and feel it would be useful when loading 'dirty' data but

Re: Add new COPY option REJECT_LIMIT

2024-02-01 Thread torikoshia
On 2024-01-27 00:20, David G. Johnston wrote: Thanks for your comments! On Fri, Jan 26, 2024 at 2:49 AM torikoshia wrote: Hi, 9e2d870 enabled the COPY command to skip soft error, and I think we can add another option which specifies the maximum tolerable number of soft errors. I remember t

Re: Add new COPY option REJECT_LIMIT

2024-01-26 Thread David G. Johnston
On Fri, Jan 26, 2024 at 2:49 AM torikoshia wrote: > Hi, > > 9e2d870 enabled the COPY command to skip soft error, and I think we can > add another option which specifies the maximum tolerable number of soft > errors. > > I remember this was discussed in [1], and feel it would be useful when > load