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

From: Andres Freund <andres(at)anarazel(dot)de>
To: Damir Belyalov <dam(dot)bel07(at)gmail(dot)com>
Cc: Danil Anisimow <anisimow(dot)d(at)gmail(dot)com>, "HukuToc(at)gmail(dot)com" <HukuToc(at)gmail(dot)com>, torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>, "a(dot)lepikhov(at)postgrespro(dot)ru" <a(dot)lepikhov(at)postgrespro(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)
Date: 2023-02-05 23:37:23
Message-ID: 20230205233723.xw5z5zmeyc57ezq3@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-02-05 23:57:47 Re: Weird failure with latches in curculio on v15
Previous Message Michael Paquier 2023-02-05 23:36:36 Re: Weird failure with latches in curculio on v15