Re: Easy form of "insert if it isn't already there"? - Mailing list pgsql-general

From Chris Angelico
Subject Re: Easy form of "insert if it isn't already there"?
Date
Msg-id CAPTjJmp5uNxwgOPKwOfZ+JXngAUypeQe+Vbuvsb0DuxxVxng_w@mail.gmail.com
Whole thread Raw
In response to Re: Easy form of "insert if it isn't already there"?  (Bartosz Dmytrak <bdmytrak@eranet.pl>)
Responses Re: Easy form of "insert if it isn't already there"?
Re: Easy form of "insert if it isn't already there"?
List pgsql-general
On Wed, Feb 15, 2012 at 5:26 PM, Bartosz Dmytrak <bdmytrak@eranet.pl> wrote:
> Hi,
> similar topic is in NOVICE mailing
> list: http://archives.postgresql.org/pgsql-novice/2012-02/msg00034.php
>
> 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;

Ah, thanks for that!

Currently the query is a single PHP pg_query_params() call, and it's
inside a larger transaction. By the look of it, this requires writing
a function to do the job, rather than embedding the logic straight
into the query - is this correct?

ChrisA

pgsql-general by date:

Previous
From: Bartosz Dmytrak
Date:
Subject: Re: Easy form of "insert if it isn't already there"?
Next
From: Scott Marlowe
Date:
Subject: Re: High checkpoint_segments