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

From: me nefcanto <sn(dot)1361(at)gmail(dot)com>
To: 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 03:44:52
Message-ID: CAEHBEOBAYsELbjC7KvifHk00jNVJvCRpZkHDML9ebsP48g4w+A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thank you all for responding. With respect, I don't understand why COPY
gets related to ETL. All of the requirements I mentioned above have nothing
to do with ETL. We have a table of categories. A hierarchical table. This
is a multitenant app. Hundreds of thousands of records are in it. We want
to calculate the hierarchical properties (nested set models, node depth,
determining leaves, materialized paths, etc.) and then update the entire
table. What does this have to do with ETL? Or as I said we create millions
of records for products, attributes of products, and pricing and media of
products to load test our system. Again, what does that have to do with ETL?

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. But when the `on_error ignore` catches problem x for each row,
then it can catch all problems for each row without any performance problem.

Let me give you an example in C#:

try
{
}
catch (SomeException ex)
{
}

becomes:

try
{
}
catch (Exception ex)
{
if (ex is SomeException)
{
}
}

The last catch clause catches everything. How does it affect performance?
Running a simple if for hundreds of millions of iterations is literally
nothing in time complexity.

As I have specified in the bug thread, from 11 RDBMSs, 7 support this. Thus
it's not an uncommon weird request.

Regards
Saeed

On Sat, Mar 1, 2025 at 8:45 PM Greg Sabino Mullane <htamfids(at)gmail(dot)com>
wrote:

> FYI the -bugs thread in question:
>
>
> https://www.postgresql.org/message-id/flat/CAEHBEOBCweDWGNHDaUk4%3D10HG0QXXJJAGXbEnFLMB30M%2BQw%2Bdg%40mail.gmail.com
>
> seems to imply the primary blocker was a unique constraint.
>
> Cheers,
> Greg
>
> --
> Crunchy Data - https://www.crunchydata.com
> Enterprise Postgres Software Products & Tech Support
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christophe Pettus 2025-03-03 03:54:20 Re: Please implement a catch-all error handler per row, for COPY
Previous Message Krishnakant Mane 2025-03-02 06:35:21 Re: create_immv issue on aws Ubuntu even after create extention