Re: discard on constraint violation

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: discard on constraint violation
Дата
Msg-id 005b01cc34d3$91c36fb0$b54a4f10$@yahoo.com
обсуждение исходный текст
Ответ на discard on constraint violation  (Sim Zacks <sim@compulab.co.il>)
Список pgsql-general
>>My situation is that I'm reading data from an external website with lots
of duplicate data. I am reading the data in a plpythonu function. I never
update, only insert. A trigger on the table that has to check if each row
exists before trying the insert is too much overhead.

Create a staging table into which you import your external data and then
write a query of the form "INSERT INTO realtable SELECT FROM stagingtable
WHERE stagingtable NOT EXISTS realtable".

David J.




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