Re: [GENERAL] newbie question - delete before insert

2010-11-20 Thread Sim Zacks
How do people implement insert or upate ( otherwise known as upsert ) behaviour in postgres i.e. insert a row if it's key does 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 r

Re: [GENERAL] newbie question - delete before insert

2010-11-20 Thread Ashish Karalkar
On 11/20/2010 02:43 PM, Thomas Kellerer wrote: > Grant Mckenzie wrote on 20.11.2010 07:00: >> How do people implement insert or upate ( otherwise known as upsert ) >> behaviour in postgres i.e. insert a row if it's key does not exist in >> the database else update the existing row? >> > > You can s

Re: [GENERAL] newbie question - delete before insert

2010-11-20 Thread Thomas Kellerer
Grant Mckenzie wrote on 20.11.2010 07:00: How do people implement insert or upate ( otherwise known as upsert ) behaviour in postgres i.e. insert a row if it's key does not exist in the database else update the existing row? You can simply send the UPDATE, if nothing was updated, it's safe to

[GENERAL] newbie question - delete before insert

2010-11-19 Thread Grant Mckenzie
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 key does not exist in the database else update the existing row? I tried using an insert rule t