Re: Add new error_action COPY ON_ERROR "log"

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, jian(dot)universality(at)gmail(dot)com, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Subject: Re: Add new error_action COPY ON_ERROR "log"
Date: 2024-03-08 18:31:49
Message-ID: CALj2ACUi9R5nWhjyONN9wW1xMwV4VdZ3zOu1Q1rQYSFjn-70qg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 8, 2024 at 4:42 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Fri, Mar 08, 2024 at 03:36:30PM +0530, Bharath Rupireddy wrote:
> > Please see the attached v5-0001 patch implementing LOG_VERBOSITY with
> > options 'default' and 'verbose'. v5-0002 adds the detailed info to
> > ON_ERROR 'ignore' option.
>
> I may be reading this patch set incorrectly, but why doesn't this
> patch generate one NOTICE per attribute, as suggested by Sawada-san,
> incrementing num_errors once per row when the last attribute has been
> processed? Also, why not have a test that checks that multiple rows
> spawn more than more messages in some distributed fashion? Did you
> look at this idea?

If NOTICE per attribute and incrementing num_errors per row is
implemented, it ends up erroring out with ERROR: missing data for
column "m" for all-column-empty-row. Shall we treat this ERROR softly
too if on_error ignore is specified? Or shall we discuss this idea
separately?

-- tests for options on_error and log_verbosity
COPY check_ign_err FROM STDIN WITH (on_error ignore, log_verbosity 'verbose');
1 {1} 1
a {2} 2
3 {3} 3333333333
4 {a, 4} 4

5 {5} 5
\.

NOTICE: detected data type incompatibility at line number 2 for
column n; COPY check_ign_err
NOTICE: detected data type incompatibility at line number 2 for
column m; COPY check_ign_err
NOTICE: detected data type incompatibility at line number 2 for
column k; COPY check_ign_err
NOTICE: detected data type incompatibility at line number 3 for
column k; COPY check_ign_err
NOTICE: detected data type incompatibility at line number 4 for
column m; COPY check_ign_err
NOTICE: detected data type incompatibility at line number 4 for
column k; COPY check_ign_err
NOTICE: detected data type incompatibility at line number 5 for
column n; COPY check_ign_err
ERROR: missing data for column "m"
CONTEXT: COPY check_ign_err, line 5: ""

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2024-03-08 18:38:32 Re: pipe_read_line for reading arbitrary strings
Previous Message Melanie Plageman 2024-03-08 18:21:36 Re: Confine vacuum skip logic to lazy_scan_skip