From: | "Zeugswetter Andreas DCP SD" <ZeugswetterA(at)spardat(dot)at> |
---|---|
To: | "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | "Csaba Nagy" <nagy(at)ecircle-ag(dot)com>, "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "Dann Corbit" <DCorbit(at)connx(dot)com>, "Simon Riggs" <simon(at)2ndquadrant(dot)com>, "Rick Gigger" <rick(at)alpinenetworking(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>, "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>, <josh(at)agliodbs(dot)com>, <pgsql-hackers(at)postgresql(dot)org>, "Jaime Casanova" <systemguards(at)gmail(dot)com>, "Peter Eisentraut" <peter_e(at)gmx(dot)net> |
Subject: | Re: MERGE vs REPLACE |
Date: | 2005-11-18 10:32:01 |
Message-ID: | E1539E0ED7043848906A8FF995BDA5799A53C4@m0143.s-mxs.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Zeugswetter Andreas DCP SD | 2005-11-18 10:45:33 | Re: Improving count(*) |
Previous Message | Tino Wildenhain | 2005-11-18 10:26:20 | Re: Improving count(*) |