newbie question - delete before insert

Поиск
Список
Период
Сортировка
От Grant Mckenzie
Тема newbie question - delete before insert
Дата
Msg-id 22219E5E-EC48-4704-A10F-F14F6DFBFFB4@optonline.net
обсуждение исходный текст
Ответы Re: newbie question - delete before insert  (Thomas Kellerer <spam_eater@gmx.net>)
Re: newbie question - delete before insert  (Sim Zacks <sim@compulab.co.il>)
Список pgsql-general
Hi,

a question that I imagine is a faq but have not been able to find much help.

How do people implement insert or upate ( otherwise known as upsert ) behaviour in postgres i.e. insert a row if it's
keydoes not exist in the database else update the existing row? 

I tried using an insert rule to delete any existing rows first then insert however this leads to infinitely recursive
rules( which postgres properly rejects. ) 

I'm guesisng that the most sensible approach would be a stored proc/function?

Cheers
G.




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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Upgrading 8.2 to 8.4: pg_restore: did not find magic string in file header\n
Следующее
От: Ron Mayer
Дата:
Сообщение: Re: Survey on backing up unlogged tables: help us with PostgreSQL development!