Re: how do I capture conflicting rows

Поиск
Список
Период
Сортировка
От Ron
Тема Re: how do I capture conflicting rows
Дата
Msg-id 34308ba9-6033-6e57-f44e-500b2ca9cad5@gmail.com
обсуждение исходный текст
Ответ на how do I capture conflicting rows  (Nikhil Ingale <niks.bgm@gmail.com>)
Ответы Re: how do I capture conflicting rows
Список pgsql-admin
On 5/15/23 00:32, Nikhil Ingale wrote:
> Hi All,
>
> The following query inserts the rows by ignoring the rows that has conflicts.
>
> INSERT INTO test (id,name,age,branch) SELECT * FROM student ON CONFLICT DO 
> NOTHING;
>
> How do I capture the conflicting records to a file while non conflicting 
> records are inserted to the table?

On conflict insert the PK into a separate table, along with a timestamp 
column populated by clock_timestamp().  (That way you can export and delete 
sets of records while it's being written to.

-- 
Born in Arizona, moved to Babylonia.



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

Предыдущее
От: Nikhil Ingale
Дата:
Сообщение: how do I capture conflicting rows
Следующее
От: Nikhil Ingale
Дата:
Сообщение: Re: how do I capture conflicting rows