Re: Bug in copy - Mailing list pgsql-bugs

From Laurenz Albe
Subject Re: Bug in copy
Date
Msg-id b9e99ded23e0b40822f028fdf0a34dfb02a4c1c4.camel@cybertec.at
Whole thread Raw
In response to Re: Bug in copy  (me nefcanto <sn.1361@gmail.com>)
List pgsql-bugs
On Sun, 2025-02-09 at 16:00 +0330, me nefcanto wrote:
> @laurenz if I use `insert into` or the `merge` would I be able to bypass records
> with errors? Or would I fail there too? I mean there are lots of ways a record
> can be limited. Unique indexes, check constraints, foreign key constraints, etc.
> What happens in those cases?

With INSERT ... ON CONFLICT, you can only handle primar and unique key violations.
MERGE allows some more freedom, but it also only checks for rows that match existing
rows.

You won't find a command that ignores or handles arbitrary kinds of errors.
You have to figure out what kinds of errors you expect and handle them explicitly
by running queries against the data.

I don't think that a catch-it-all handler that handles all errors would be very
useful.  Normally, there are certain errors you want to tolerate, while others
should be considered unrecoverable and lead to errors.

Yours,
Laurenz Albe



pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Bug in copy
Next
From: PG Bug reporting form
Date:
Subject: BUG #18801: JIT recompiles function for each row if custom aggregation function is used