Re: INSERT OU UPDATE WITHOUT SELECT? - Mailing list pgsql-performance

From Alvaro Herrera
Subject Re: INSERT OU UPDATE WITHOUT SELECT?
Date
Msg-id 20060530223818.GK31547@surnet.cl
Whole thread Raw
In response to Re: INSERT OU UPDATE WITHOUT SELECT?  (PFC <lists@peufeu.com>)
List pgsql-performance
PFC wrote:
> >PostgreSQL does not support MERGE at the moment, sorry.
>
>     Issue an UPDATE, and watch the rowcount ; if the rowcount is 0,
>     issue an  INSERT.
>     Be prepared to retry if another transaction has inserted the row
> meanwhile, though.

Oh, you mean, like the example that's in the documentation?

http://www.postgresql.org/docs/8.1/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING

Example 36-1

>     MERGE would be really useful.

It has been discussed before -- MERGE is something different.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

pgsql-performance by date:

Previous
From: PFC
Date:
Subject: Re: Optimizing a huge_table/tiny_table join
Next
From: "Dave Dutcher"
Date:
Subject: Re: INSERT OU UPDATE WITHOUT SELECT?