pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@commandprompt.com>
To: PFC <lists@peufeu.com>
Cc: Jonah H. Harris <jonah.harris@gmail.com>
Cc: Waldomiro <waldomiro@shx.com.br>
Cc: pgsql-performance@postgresql.org
Subject: Re: INSERT OU UPDATE WITHOUT SELECT?
Date: Tue, 30 May 2006 18:38:18 -0400
Message-ID: <20060530223818.GK31547@surnet.cl> (raw)
In-Reply-To: <op.tadyc1jwcigqcu@apollo13>
References: <447C8F1D.8090404@shx.com.br>
	<36e682920605301405u4d665fcftbe0a97b5753f5209@mail.gmail.com>
	<op.tadyc1jwcigqcu@apollo13>

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



view thread (7+ messages)  latest in thread

Message-ID: <20060530223818.GK31547@surnet.cl>
Permalink:  ../20060530223818.GK31547@surnet.cl/
Also on:    postgresql.org/message-id/20060530223818.GK31547@surnet.cl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: alvherre@commandprompt.com, lists@peufeu.com, jonah.harris@gmail.com, waldomiro@shx.com.br
  Subject: Re: INSERT OU UPDATE WITHOUT SELECT?
  In-Reply-To: <20060530223818.GK31547@surnet.cl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox