From: | Mukesh Rajpurohit <vivasvan1902(at)gmail(dot)com> |
---|---|
To: | Scott Ribe <scott_ribe(at)elevated-dev(dot)com> |
Cc: | Nikhil Ingale <niks(dot)bgm(at)gmail(dot)com>, 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:58:00 |
Message-ID: | CAL+ptAAH7Cd_-e43RsL17pTo4r2XQFyjG6DFBE2UaCri9eaXpg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Hi Nikhil,
After loading data in the target table query...
insert into temptable_conflictingrows (select * from sourcetable except
select * from targettable_nonconflictingrows);
Thanks
Mukesh
On Mon, May 15, 2023 at 6:48 PM Scott Ribe <scott_ribe(at)elevated-dev(dot)com>
wrote:
> > 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 ...
>
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Janes | 2023-05-15 14:40:18 | Re: Options for more aggressive space reclamation in vacuuming? |
Previous Message | Scott Ribe | 2023-05-15 13:17:36 | Re: how do I capture conflicting rows |