Re: on_error table, saving error info to a table

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: on_error table, saving error info to a table
Date: 2026-07-14 07:16:20
Message-ID: CACJufxE08V0x86cnnLRRWq7Os-BY6D94pqD6Hfb4vPHz9nheTA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, May 29, 2026 at 6:41 AM Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> wrote:
>
> Generally looks good to me, I only found a few typos:
>
> + errmsg("saving error information to table \"%s\" row due to
> data type incompatibility at line %" PRIu64 " for column \"%s\":
> \"%s\"",
>
> Is row needed there?
>
> + * TODO: Allow cstate->error_rel to be a partitioned table. This should be
> + * not difficult, but requires proper handling of constraints and triggers
>
> should not be difficult
>
> + privileges on it. During the error records inseration,
> + <literal>NOT NULL</literal> and <literal>CHECK</literal>
> constraints are enforced,
> + and both row-level and statement-level triggers will be fired.
>
> record's insertion
>

I fixed these two issues.
I rebased the patch and made some tweaks; nothing significant.

> Maybe this could explicitly mention that failure to insert into the
> error table will fail the copy statement? Or some better wording of
> that, as it is allowed behavior with triggers.
>

I plan to document this more later, since the overall design may not
be completely bulletproof yet.

--
jian
https://www.enterprisedb.com/

Attachment Content-Type Size
v14-0001-export-ExecInsert.patch text/x-patch 4.8 KB
v14-0002-COPY-FROM-on_error-table-error_table-errtbl.patch text/x-patch 57.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2026-07-14 07:27:19 Re: blkreftable.c needs more sanity checks
Previous Message Andrei Lepikhov 2026-07-14 07:07:02 Re: RFC: Logging plan of the running query