Re: Please implement a catch-all error handler per row, for COPY

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: me nefcanto <sn(dot)1361(at)gmail(dot)com>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Please implement a catch-all error handler per row, for COPY
Date: 2025-03-03 08:55:03
Message-ID: b67f0fc8f3eb3b798b9c7145b20a0033af2da47e.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 2025-03-03 at 07:14 +0330, me nefcanto wrote:
> The point is, that there is already an `on_error ignore` clause there. This means that
> somewhere there is a try/catch per row. If I'm wrong, please let me know.

The crucial point that Tom referred to is the "per row". What is a row?

Imagine you have a COPY FROM statement for a table with three columns,
and the data look like this:

1,Smith,John
2,Lewis,Jerry
Lee
3,Prince
4,Albe,Laurenz

We may be able to guess what is meant, but how shall the machine know
where the line boundaries are, which data to ignore and which to process?

Currently, that is no problem, because errors are only identified
after the data have been successfully parsed.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jakob Teuber 2025-03-03 16:05:10 Infinite loop for generate_series with timestamp arguments
Previous Message Adrian Klaver 2025-03-03 05:33:07 Re: Please implement a catch-all error handler per row, for COPY