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

From: Bartosz Dmytrak <bdmytrak(at)eranet(dot)pl>
To: btober(at)computer(dot)org
Cc: Chris Angelico <rosuav(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Easy form of "insert if it isn't already there"?
Date: 2012-02-16 07:08:08
Message-ID: CAD8_UcYGOEzvnFkSPMyT2_YfP_KvFX2zscxfCE5HmYNW7kHA9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Maybe to show how "found" works and how to ignore errors - that is my
assumption only.

Regards,
Bartek

2012/2/15 Berend Tober <btober(at)broadstripe(dot)net>

> 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<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?
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/**mailpref/pgsql-general<http://www.postgresql.org/mailpref/pgsql-general>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sandro Santilli 2012-02-16 07:34:43 Re: [postgis-users] ST_AsJpeg
Previous Message Venkat Balaji 2012-02-16 06:21:02 Re: [GENERA]: Postgresql-9.1.1 synchronous replication issue