| From: | jian he <jian(dot)universality(at)gmail(dot)com> |
|---|---|
| To: | solaimurugan vellaipandiyan <drsolaimurugan(dot)v(at)gmail(dot)com> |
| Cc: | Nishant Sharma <nishant(dot)sharma(at)enterprisedb(dot)com>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: on_error table, saving error info to a table |
| Date: | 2026-05-12 07:06:46 |
| Message-ID: | CACJufxEaqr1tskQCM6qhrdwZVFQim9t2UBLoGvBo0OAC2i6uKA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, May 11, 2026 at 3:32 PM solaimurugan vellaipandiyan
<drsolaimurugan(dot)v(at)gmail(dot)com> wrote:
>
> I additionally tested ERROR_TABLE behavior with a BEFORE INSERT
> trigger attached to err_tbl.
> From my testing, COPY still succeeds and malformed rows continue to be
> inserted into err_tbl even when triggers are present on the
> ERROR_TABLE. The trigger function also appears to execute normally
> during error row insertion. For example, using a trigger function with
> RAISE NOTICE produced:
>
> NOTICE: trigger fired
> for each malformed row redirected into err_tbl.
> Since the patch comments mention restrictions around triggers for
> ERROR_TABLE, I was not sure whether this current behavior is
> intentional or whether the trigger restriction checks are still
> incomplete.
With v11, I changed the behavior to:
Statement-level triggers on the ERROR_TABLE are fired unconditionally,
regardless of whether an error occurred or not.
Each row inserted into the ERROR_TABLE will fire both the BEFORE
INSERT FOR EACH ROW and AFTER INSERT FOR EACH ROW triggers.
| Attachment | Content-Type | Size |
|---|---|---|
| v11-0001-export-ExecInsert.patch | text/x-patch | 4.8 KB |
| v11-0002-COPY-FROM-on_error-table-error_table-errtbl.patch | text/x-patch | 56.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | Henson Choi | 2026-05-12 07:01:05 | Re: Row pattern recognition |