Re: newbie question - delete before insert

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: newbie question - delete before insert
Date: 2010-11-20 09:13:07
Message-ID: ic83f2$jpu$1@dough.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ashish Karalkar 2010-11-20 09:58:47 Re: newbie question - delete before insert
Previous Message Ron Mayer 2010-11-20 06:52:16 Re: Survey on backing up unlogged tables: help us with PostgreSQL development!