Looks like PostgreSQL supports a schema object called a rule.
http://www.postgresql.org/docs/current/static/rules-update.html
You could create a rule ON INSERT
for a given table, making it do NOTHING
if a row exists with the given primary key value, or else making it do an UPDATE
instead of the INSERT
if a row exists with the given primary key value.
I haven't tried this myself, so I can't speak from experience or offer an example.