Re: how do I capture conflicting rows

Поиск
Список
Период
Сортировка
От Mukesh Rajpurohit
Тема Re: how do I capture conflicting rows
Дата
Msg-id CAL+ptAAH7Cd_-e43RsL17pTo4r2XQFyjG6DFBE2UaCri9eaXpg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: how do I capture conflicting rows  (Scott Ribe <scott_ribe@elevated-dev.com>)
Список 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@elevated-dev.com> wrote:
> 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 ...



В списке pgsql-admin по дате отправления:

Предыдущее
От: Scott Ribe
Дата:
Сообщение: Re: how do I capture conflicting rows
Следующее
От: Jeff Janes
Дата:
Сообщение: Re: Options for more aggressive space reclamation in vacuuming?