I am not the most advanced SQL developer by any means. Why is UPSERT needed/advantageous when you can do this?
update [table] set ...; if @@ROWCOUNT = 0 insert into [table] ... update [table] set ...; if @@ROWCOUNT = 0 insert into [table] ...For example: http://www.postgresql.org/docs/current/static/plpgsql-contro...
This is ugly an inefficient.
There are other ways to emulate upserts, but they tend to have performance and/or concurrency considerations.