Re: Replace into...?

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: "Diehl, Jeffrey" <jdiehl(at)sandia(dot)gov>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Replace into...?
Date: 2001-03-27 20:09:51
Message-ID: Pine.LNX.4.30.0103272207200.1215-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net http://yi.org/peter-e/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Diehl, Jeffrey 2001-03-27 20:28:00 RE: Replace into...?
Previous Message Tom Lane 2001-03-27 20:04:11 Re: Replace into...?