Re: on_error table, saving error info to a table

From: solaimurugan vellaipandiyan <drsolaimurugan(dot)v(at)gmail(dot)com>
To: jian he <jian(dot)universality(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-07 11:32:56
Message-ID: CAHEL7KSwRXeQNyh1zynYi9TKERU8GxR1iG1MfsvqKN9qZCtGfw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I tested the v9 patch series on current PostgreSQL HEAD.

The patches did not apply cleanly on the latest tree because of a small
conflict in nodeModifyTable.c, but after resolving it manually, the build
and installation completed successfully.

I initialized a fresh cluster and verified that the built-in composite type
copy_error_saving is created correctly during initdb.

I tested the feature using the following setup:

CREATE TABLE err_tbl OF copy_error_saving;

CREATE TABLE t(a int, b int, c int);

COPY t

FROM STDIN

WITH (

FORMAT csv,

ON_ERROR table,

ERROR_TABLE err_tbl

);

Input used:

1,2,3

4,5,x

7,8,9

From my testing:

-

valid rows were inserted into the target table correctly
-

malformed rows were stored in ERROR_TABLE as expected
-

COPY continued processing the remaining rows successfully

The latest executor-based approach using ExecInsert() looks cleaner and
easier to follow compared to the earlier direct insertion approach.

I also feel the built-in composite type approach makes the ERROR_TABLE
validation simpler and more maintainable compared to manually checking all
columns and types.

Regards,
Solaimurugan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message solaimurugan vellaipandiyan 2026-05-07 11:38:38 Re: postgres_fdw: Use COPY to speed up batch inserts
Previous Message vignesh C 2026-05-07 10:45:38 Re: Proposal: Conflict log history table for Logical Replication