Re: newbie question - delete before insert - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: newbie question - delete before insert
Date
Msg-id ic83f2$jpu$1@dough.gmane.org
Whole thread Raw
In response to newbie question - delete before insert  (Grant Mckenzie <mckenzig@optonline.net>)
Responses Re: newbie question - delete before insert  (Ashish Karalkar <ashish.karalkar@netcore.co.in>)
List pgsql-general
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 send the INSERT

Regards
Thomas


pgsql-general by date:

Previous
From: Ron Mayer
Date:
Subject: Re: Survey on backing up unlogged tables: help us with PostgreSQL development!
Next
From: Ashish Karalkar
Date:
Subject: Re: newbie question - delete before insert