Computers... 'nuff said!
The easiest way I found to simulate a INSERT OR UPDATE using PostgreSQL (or pretty much any other RDB) is using the INSERT INTO ... SELECT syntax:...
markus.dresch.net