Re: MERGE vs REPLACE - Mailing list pgsql-hackers

From Zeugswetter Andreas DCP SD
Subject Re: MERGE vs REPLACE
Date
Msg-id E1539E0ED7043848906A8FF995BDA5799A53C4@m0143.s-mxs.net
Whole thread Raw
In response to MERGE vs REPLACE  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
> Unless you have a table lock, INSERT has to be before UPDATE, think
UPDATE, UPDATE (both fail), INSERT, INSERT.

> > update
> > if no rows updated
> >   insert
> >   if duplicate key
> >     update
> >     if no rows updated goto insert

That is why you have the loop. This is not a problem with above code,
because only one insert succeeds
while the others then do the update.

Andreas


pgsql-hackers by date:

Previous
From: Tino Wildenhain
Date:
Subject: Re: Improving count(*)
Next
From: "Zeugswetter Andreas DCP SD"
Date:
Subject: Re: Improving count(*)