From: Laurenz Albe <laurenz.albe@cybertec.at>
To: me nefcanto <sn.1361@gmail.com>
Cc: Zhang Mingli <zmlpostgres@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Bug in copy
Date: Sun, 09 Feb 2025 17:39:47 +0100
Message-ID: <b9e99ded23e0b40822f028fdf0a34dfb02a4c1c4.camel@cybertec.at> (raw)
In-Reply-To: <CAEHBEOD7QrxcsAh09qydomb4sV_HoZ4y+_C9-8pudJ8NDha=Tg@mail.gmail.com>
References: <CAEHBEOBCweDWGNHDaUk4=10HG0QXXJJAGXbEnFLMB30M+Qw+dg@mail.gmail.com>
<fa5c934f-9b57-4900-ad15-bb9c6d9d414d@Spark>
<CAEHBEOB2LOaDZycmkjcYDG6JJF0_kFX3gc9H+ZrL=cPNF+WnOg@mail.gmail.com>
<3a1189c579c1e0189f3aae60d2cdf7b7dcd6c1cd.camel@cybertec.at>
<CAEHBEOD7QrxcsAh09qydomb4sV_HoZ4y+_C9-8pudJ8NDha=Tg@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: laurenz.albe@cybertec.at, sn.1361@gmail.com, zmlpostgres@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: Bug in copy
In-Reply-To: <b9e99ded23e0b40822f028fdf0a34dfb02a4c1c4.camel@cybertec.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox