Skip dups on INSERT instead of generating an error ...

Поиск
Список
Период
Сортировка
От Marc G. Fournier
Тема Skip dups on INSERT instead of generating an error ...
Дата
Msg-id 20031212165007.L81928@ganymede.hub.org
обсуждение исходный текст
Ответы Re: Skip dups on INSERT instead of generating an error ...  ("scott.marlowe" <scott.marlowe@ihs.com>)
Re: Skip dups on INSERT instead of generating an error ...  ("scott.marlowe" <scott.marlowe@ihs.com>)
Re: Skip dups on INSERT instead of generating an error ...  (Tomasz Myrta <jasiek@klaster.net>)
Список pgsql-sql
I need to be able to run an INSERT INTO / SELECT FROM UNION which combines
two tables into one ... *but* ... the INTO table has a primary key on the
first column, so if the result of the UNION generates dups, by default, of
course, it will generate errors ... what I'd like is to have it so that it
just skips over those records.

First thought would be to write a quite plpgsql function that would do a
SELECT first, to see if the value already exists, and if not, then do the
INSERT ... but am wondering if maybe there is a cleaner way that I'm not
thinking of?

----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: scrappy@hub.org           Yahoo!: yscrappy              ICQ: 7615664


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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: simple LEFT JOIN giving wrong results ...
Следующее
От: "scott.marlowe"
Дата:
Сообщение: Re: Skip dups on INSERT instead of generating an error ...