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

From: Chris Angelico <rosuav(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Easy form of "insert if it isn't already there"?
Date: 2012-02-15 06:32:42
Message-ID: CAPTjJmp5uNxwgOPKwOfZ+JXngAUypeQe+Vbuvsb0DuxxVxng_w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Feb 15, 2012 at 5:26 PM, Bartosz Dmytrak <bdmytrak(at)eranet(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2012-02-15 06:51:51 Re: High checkpoint_segments
Previous Message khizer 2012-02-15 06:29:24 postgresql-9.0