Re: Easy form of "insert if it isn't already there"?

From: Berend Tober <btober(at)broadstripe(dot)net>
To: Chris Angelico <rosuav(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Easy form of "insert if it isn't already there"?
Date: 2012-02-15 07:37:00
Message-ID: 4F3B609C.4050103@computer.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Chris Angelico wrote:
> On Wed, Feb 15, 2012 at 5:26 PM, Bartosz Dmytrak<bdmytrak(at)eranet(dot)pl> wrote:
>>
>> e.g. You can use BEGIN... EXCEPTION.... END, good example of
>> such approach is
>> there: http://www.postgresql.org/docs/9.1/static/plpgsql-control-structures.html#PLPGSQL-UPSERT-EXAMPLE;
>

I wonder why, in that example, you would not try the INSERT
first, and if that fails, then do the update?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2012-02-15 08:14:25 Re: High checkpoint_segments
Previous Message Bartosz Dmytrak 2012-02-15 07:14:59 Re: Easy form of "insert if it isn't already there"?