Re: how do I capture conflicting rows

From: Scott Ribe <scott_ribe(at)elevated-dev(dot)com>
To: Nikhil Ingale <niks(dot)bgm(at)gmail(dot)com>
Cc: Ron <ronljohnsonjr(at)gmail(dot)com>, Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: how do I capture conflicting rows
Date: 2023-05-15 13:17:36
Message-ID: 36F0306C-E96A-4516-B36E-E97612C95F59@elevated-dev.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> On May 15, 2023, at 12:25 AM, Nikhil Ingale <niks(dot)bgm(at)gmail(dot)com> wrote:
>
> Thing is there is a list of tables (350+ tables) on which I'm running the insert query i.e., INSERT INTO table ON CONFLICT DO NOTHING to continue inserting the records by ignoring the conflicting rows. But, at the same time I would like to capture the conflicting rows or every single conflicting column (not just the PK's) and their values for every single table.

Create a "staging" table without constraints. Load all rows into it. Query for conflicts and report to user. Delete conflicting rows. Then INSERT INTO ... SELECT * FROM ...

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Mukesh Rajpurohit 2023-05-15 13:58:00 Re: how do I capture conflicting rows
Previous Message Alvaro Herrera 2023-05-15 11:15:54 Re: how do I capture conflicting rows