Re: how do I capture conflicting rows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Hi Nikhil,

After loading data in the target table query...
insert into temptable_conflictingrows (select * from sourcetable except select * from targettable_nonconflictingrows);


On Mon, May 15, 2023 at 6:48 PM Scott Ribe <scott_ribe@xxxxxxxxxxxxxxxx> wrote:
> On May 15, 2023, at 12:25 AM, Nikhil Ingale <niks.bgm@xxxxxxxxx> 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 ...

[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux