On Sun, Mar 04, 2007 at 02:55:47PM +0200, Hannu Krosing wrote: > Is'nt the standard way of doing it thus: > > UPDATE > IF NOT FOUND THEN > INSERT > IF DUPLICATE KEY THEN > UPDATE > END IF > END IF > > At least this is how UPSERT is usually done in plpgsql
Well, you need to loop, because that last UPDATE can get a not-found again, so you have to keep trying both until they work. I think MERGE would still be cool, because then it's only one command that has to be repeated, rather than two. Have a nice day, -- Martijn van Oosterhout <firstname.lastname@example.org> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to > litigate.
Description: Digital signature