Re: Merge condition in postgresql

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Amit jain <amitjain(dot)bit(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Merge condition in postgresql
Date: 2008-02-04 14:27:42
Message-ID: 20080204142742.GE5031@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

* Amit jain (amitjain(dot)bit(at)gmail(dot)com) wrote:
> I am currently migrating database from ORACLE to postgresql but i am stucked
> up at one point while creating procedures.
> There is a query which has used oracle MERGE condition so how can i change
> this query as per posgresql. kindly suggest me its very urgent.

If you're talking about what I think you're talking about, then
basically you need to break up the MERGE into seperate insert/update
steps. You just have to write the queries such that if the record
doesn't exist, it gets inserted, and if it does exist, then it gets
updated. MERGE just allows you to do this in a nicer, somewhat more
efficient, way. If you've got alot of transactions happening around the
same time with the table in question then you may also have to write
your logic to be able to handle a rollback and to try again.

Enjoy,

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Wes 2008-02-04 15:00:03 Re: REINDEX on large DB vs. DROP INDEX/CREATE INDEX
Previous Message Ron Mayer 2008-02-04 14:00:01 Re: configurability of OOM killer