From: Scott Ribe <scott_ribe@elevated-dev.com>
To: Nikhil Ingale <niks.bgm@gmail.com>
Cc: Ron <ronljohnsonjr@gmail.com>
Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: how do I capture conflicting rows
Date: Mon, 15 May 2023 07:17:36 -0600
Message-ID: <36F0306C-E96A-4516-B36E-E97612C95F59@elevated-dev.com> (raw)
In-Reply-To: <CALXkTpxRGtUjH+GP67W_+fXahaUUmpTPE+LiLugF--_862PD-Q@mail.gmail.com>
References: <CALXkTpx3iLuGRx1_4N6GJ85ptoW4n4XSdh3ChJLE-hrFGC982g@mail.gmail.com>
<34308ba9-6033-6e57-f44e-500b2ca9cad5@gmail.com>
<CALXkTpxRGtUjH+GP67W_+fXahaUUmpTPE+LiLugF--_862PD-Q@mail.gmail.com>
> On May 15, 2023, at 12:25 AM, Nikhil Ingale <niks.bgm@gmail.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 ...
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-admin@postgresql.org
Cc: scott_ribe@elevated-dev.com, niks.bgm@gmail.com, ronljohnsonjr@gmail.com, pgsql-admin@lists.postgresql.org
Subject: Re: how do I capture conflicting rows
In-Reply-To: <36F0306C-E96A-4516-B36E-E97612C95F59@elevated-dev.com>
* 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