Re: Replace into...? - Mailing list pgsql-sql

From Peter Eisentraut
Subject Re: Replace into...?
Date
Msg-id Pine.LNX.4.30.0103272207200.1215-100000@peter.localdomain
Whole thread Raw
In response to Replace into...?  ("Diehl, Jeffrey" <jdiehl@sandia.gov>)
List pgsql-sql
Diehl, Jeffrey writes:

> I'm in the process of migrating a database and application suite from mysql
> to postgresql.  The problem is that I've used
> mysql's "replace into..." quite frequently...

begin transaction;
update ...
<if zero rows> insert ...
<endif>
commit;

or some permutation thereof.  If you need to do a lot of this, writing a
PL/pgSQL function might be worthwhile.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



pgsql-sql by date:

Previous
From: "Diehl, Jeffrey"
Date:
Subject: Replace into...?
Next
From: Tom Lane
Date:
Subject: Re: Replace into...?