H,
On 2023-02-03 13:27:24 +0300, Damir Belyalov wrote:
> @@ -625,6 +628,173 @@ CopyMultiInsertInfoStore(CopyMultiInsertInfo *miinfo, ResultRelInfo *rri,
> miinfo->bufferedBytes += tuplen;
> }
>
> +/*
> + * Safely reads source data, converts to a tuple and fills tuple buffer.
> + * Skips some data in the case of failed conversion if data source for
> + * a next tuple can be surely read without a danger.
> + */
> +static bool
> +SafeCopying(CopyFromState cstate, ExprContext *econtext, TupleTableSlot *myslot)
> + BeginInternalSubTransaction(NULL);
> + CurrentResourceOwner = sfcstate->oldowner;
I don't think this is the right approach. Creating a subtransaction for
each row will cause substantial performance issues.
We now can call data type input functions without throwing errors, see
InputFunctionCallSafe(). Use that to avoid throwing an error instead of
catching it.
Greetings,
Andres Freund