Re: Add new error_action COPY ON_ERROR "log"

Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>

From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: torikoshia <torikoshia@oss.nttdata.com>, "David G. Johnston" <david.g.johnston@gmail.com>, jian.universality@gmail.com, Pgsql Hackers <pgsql-hackers@postgresql.org>, Alexander Korotkov <aekorotkov@gmail.com>
Date: 2024-03-11T12:30:00Z
Lists: pgsql-hackers

Attachments

On Mon, Mar 11, 2024 at 11:16 AM Michael Paquier <michael@paquier.xyz> wrote:
>
> At the end of the day, this comes down to what is more helpful to the
> user.  And I'd agree on the side what ON_ERROR does currently, which
> is what your patch relies on: on the first conversion failure, give up
> and skip the rest of the row because we cannot trust its contents.
> That's my way of saying that I am fine with the proposal of your
> patch, and that we cannot provide the full state of a row without
> making the error stack of COPY more invasive.

+1.

> +      <literal>verbose</literal>, a <literal>NOTICE</literal> message
> +      containing the line number and column name for each discarded row is
> +      emitted.
>
> This should clarify that the column name refers to the attribute where
> the input conversion has failed, I guess.  Specifying only "column
> name" without more context is a bit confusing.

Done.

Please see the attached v6 patch set.

-- 
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Commits

  1. Add new COPY option LOG_VERBOSITY.

  2. Add tests for more row patterns with COPY FROM .. (ON_ERROR ignore)

  3. Support writing "CREATE/ALTER TABLE ... SET STORAGE DEFAULT".